BookmarkSubscribeRSS Feed
dxiao2017
Lapis Lazuli | Level 10

And @Hakob , proc rank also works:

data salary;
   input id salary1-salary4;
   datalines;
1 12 34 50 70
2 34 45 52 12
3 43 12 36 22
4 32 29 80 37
5 21 10 90 43
;
run;
proc print data=salary;run;

proc rank data=salary out=salrk descending;
   var salary1-salary4;
   ranks sal1rk sal2rk sal3rk sal4rk;
run;
proc print data=salrk;run;

dxiao2017_0-1757056945281.png

 

dxiao2017
Lapis Lazuli | Level 10

And @Hakob , there is a technique of proc means can also output top 3 values using output out=top3list(idgroup(max(var) out[3]) (I cannot remember or identify all the necessary and basic and correct syntax for it, it's just part of the statement), but I would not recommend to use this technique due to the above complexities and difficulties.

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore Now →
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
  • 16 replies
  • 15437 views
  • 17 likes
  • 6 in conversation