- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 02-13-2022 03:57 AM
(754 views)
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Ronein,
It looks like there is a "t" missing, try notsorted, as it appears in the error message.
Kind regards,
Amir.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.