Hello,
I am trying to organize an income variable into quintiles. I understand that proc univariate will show me 1%, 5%, 25%, 50%, ect., but I need to see the break points for 20%, 40%, 60% and 80% and I am just not sure what to do.
I have messed around with proc rank, but I can't get it to give me output so that I can see that, for example, if I want to look at 0 to X dollars is the first 20% of income, then 20 to 40, 40 to 60, and 60 to 80 and then 80 on up.
Essentially turning a continuous variable into a categorical one, but I don't know where to set the breaks.
Thanks,
M
Hello @MegLurtz and welcome to the SAS Support Communities!
The OUTPUT statement of PROC UNIVARIATE has options PCTLPTS= and PCTLPRE= where you can specify and name percentiles of your choice, e.g. 20 to 80 by 20.
Since P20, P40, P60 and P80 are fairly common percentiles, they are also available in PROC MEANS/PROC SUMMARY: see the list of "statistic-keywords".
Example:
proc means data=have min p20 p40 p60 p80 max;
var income;
run;
PROC RANK will create the categorical variable for you, though not the dummies. Depending on the PROC you're using next, it may or may not need dummy variables.
proc rank data=have out=want groups=5;
var income;
rank rank_income;
run;
proc print data=want;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.