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;
Hi @Ronein,
It looks like there is a "t" missing, try notsorted, as it appears in the error message.
Kind regards,
Amir.
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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.