BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello

Foe each customer I have a data set with wealth value and also values of percentiles that were calculated from all data.

My purpose- For each customer find to which percentile the value wealth belong.

For example:

wealth 300 belong to P90

wealth 50 belong to P20

What is the way to classify each value to percentile group?

 

 

 


Data have;
input CustID wealth P5 P10 P20 P30 P40 P50 P60 P70 P80 P90 P95 ;
cards;
1 300 20 40 70 90 120 150 200 230 280 400 500  
2 50 20 40 70 90 120 150 200 230 280 400 500
;
Run;

 

 

3 REPLIES 3
ballardw
Super User

Of those P variables are to be the same for every value of "wealth" then create a format to display the desired values, or even the text "PXX".

 

RULES not EXAMPLES.

 

What you have given us means we cannot have a good chance of what to do with a value of 113.

 

Plus, you may want to look closely at the definition of percentiles. Looking at those values I would have a hard time agreeing that 300 was in the 90th percentile, 80th perhaps but not 90th.

Ksharp
Super User
Why not use the way(proc format) proposed by Paige ? Like:

proc format;
value fmt(default=8)
low-20='P5 '
20<-40='P10 '
......
400<-500='P95 '
500<-high='P100'
run;

And using PUT() function:
group=put(wealth ,fmt.);

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 626 views
  • 2 likes
  • 4 in conversation