BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 323 views
  • 2 likes
  • 3 in conversation