BookmarkSubscribeRSS Feed
MegLurtz
Calcite | Level 5

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

3 REPLIES 3
FreelanceReinh
Jade | Level 19

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;
MegLurtz
Calcite | Level 5
Thank you!
Reeza
Super User

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;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 10247 views
  • 0 likes
  • 3 in conversation