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.
Navigate AI governance with SAS tools for compliance and ethical AI practices. Try SAS Ai Navigator for free for the first six months.
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.