I keep getting error message after trying to 1.sort by ID and 2. sort 2 other variable by descending
PROC SORT DATA=ALLMOVCODES;
BY ID DESCENDING MOVDATE DESCENDING MOVTIME;
RUN;
ERROR 180-322: Statement is not valid or it is used out of proper order.
Please show us (and from now on, every time you get an error in the log, please show us) the entire log for the DATA step or PROC in question, emphasis on entire log for the DATA step or PROC in question. Please do not show us parts of the log for the DATA step or PROC in question.
Large economy sized hint:
Copy from the log the entire procedure code along with all the notes, warnings and such generated. Paste the copied text into a text box opened on the forum with the </> icon to preserve formatting. Many of the error messages will show diagnostic characters where SAS determined the error occurred. With the entire text we have what was actually submitted and where SAS shows the error.
The most common cause of this particular error is missing a semicolon somewhere before the code you show (assuming your shown code is what was actually submitted). Or a missing semicolon somewhere in what you have typed.
Please have a look at the following forum posts
And make sure you checked for what @ballardw has said in his post.
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.