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;
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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.