BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

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.);

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 485 views
  • 2 likes
  • 4 in conversation