Hello All,
I have some questions, regarding percentiles in proc univariate. I am able to calculate the percentiles from 50 to 100 by 5 using the below output statement.
output pctlpre=P_ pctlpts=50 to 100 by 5 ;
When doing so I get the 80-100th percentile equal a success rate of 100. Does this mean that any one with a success rate of 100 belongs in all of these percentiles? Also, is there a way that I can have sas create a data set for me with a column indicateing what percentile everyone belongs in?
ID | SR | Pct |
1 | 100 | 100 |
2 | 82 | 50 |
3 | 97 | 70 |
How would that work with 80-100 being equal?
Thanks for your help.
It probably reflects either the number of responses or the number of unique responses in your data.
If you only have 5 response for instance, 1,2,3,4,5 then the Value 5 would have percentiles from 85 to 100.
You may need to clarify exactly what you mean for percentile if you have fewer than 100 responses to work with as in that case you will have multiple integer percentiles (1, 2, 3, ...,98,99) possible for the same value.
One way would be to use PROC Rank with groups = 100 for your numeric variable
proc rank data=have out=want groups=100;
var variablename;
ranks variablenamerank;
run;
I have over 250 observation with 20 unique success rates.
If you have 20 unique values then each one will represent a percentile group of 5% roughly.
This depends a bit on how you define your percentiles. Look at the PCTLDEF option in Proc Univariate to see your options
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.