DATA Step, Macro, Functions and more

Proc Univariate and the 90th Percentile

Posts: 24

Proc Univariate and the 90th Percentile

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? 


1 100 100
2 82 50
3 97 70


How would that work with 80-100 being equal?


Thanks for your help.



Super User
Posts: 10,483

Re: Proc Univariate and the 90th Percentile

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;


Posts: 24

Re: Proc Univariate and the 90th Percentile

I have over 250 observation with 20 unique success rates. 

Super User
Posts: 17,784

Re: Proc Univariate and the 90th Percentile

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



Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation