BookmarkSubscribeRSS Feed
vishalrajpoot3
Obsidian | Level 7

 

Hi There-

 

Please help to understand when I am sorting the data by below code and using the new created data set abc123 with by keyword on sorted variables, why SAS is showing error ''BY variables are not properly sorted on data set WORK.ABC1234"

 

Also how can I use variable actual with by keyword in data step ?

 

proc sort data=sashelp.prdsal2 (keep=country actual) out=abc1234;
by country descending actual;
run;

 

data abc;
set abc1234;
by country actual;
run;

 

 

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

There is a word missing in your second by statement which appears in the first by statement...

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 775 views
  • 0 likes
  • 2 in conversation