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

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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