BookmarkSubscribeRSS Feed
Renee1984
Calcite | Level 5

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.

3 REPLIES 3
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
ballardw
Super User

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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 3 replies
  • 878 views
  • 1 like
  • 4 in conversation