BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello

Why nosorted is not working here?

28 by col1 col2 nosorted.;
_________
22
201
ERROR 22-322: Syntax error, expecting one of the following: a name, -, :, ;, DESCENDING, GROUPFORMAT, NOTSORTED, _ALL_,
_CHARACTER_, _CHAR_, _NUMERIC_.

 

 

data have;
input col1 col2;
datalines;
101 20
101 20
101 15
;
run;
data want4;
set have;
by col1 col2 nosorted;
if first.col2 then seq_id=1;
else if first.col2 then seq_id+1;
run;
 
2 REPLIES 2
Amir
PROC Star

Hi @Ronein,

 

It looks like there is a "t" missing, try notsorted, as it appears in the error message.

 

Kind regards,

Amir.

Kurt_Bremser
Super User

Just read the log, it already tells you:

28 by col1 col2 nosorted.;
_________
22
201
ERROR 22-322: Syntax error, expecting one of the following: a name, -, :, ;, DESCENDING, GROUPFORMAT, NOTSORTED, _ALL_,
_CHARACTER_, _CHAR_, _NUMERIC_.

And a Google search (Maxim 6) for  "sas nosorted" will reveal the correct spelling in the first result.

CFC_SAS_Communities_400x225.jpgCFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1248 views
  • 2 likes
  • 3 in conversation