I have to sort a dataset by 5 sizes i.e. size 1 (bottom 20%), size 2 (20-40%), size 3 (40-60%), size 4 (60-80%) and size 5 (top 20%).
I require some feedback as to whether proc univariate or proc rank would be more approriate?
thank you
proc univariate data=iglib.mktcap6yrs noprint;
by dsname;
var CY;
output out=mktcapsorted pctlpre=P pctlpts=10 to 100 by 20;
run;
proc rank data= mydataset groups=5
out=rankedset;
by age;
var var2;
ranks varrank;
;
run;
yup i just need to rank them from size 1 to 5 which i have managed to achieve through the proc rank group=5.
Is there a way to rename each rank? i.e. 0 = small...5=big.
You wouldn't change the data. But you could change how the values print by using PROC FORMAT, then apply the format when printing to translate the five numbers into words.
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!
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.