turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Calculating Percentiles

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-24-2009 04:30 PM

I'm trying to find a procedure in SAS that produces percentiles according to the formula 100*(n-1)/N-1 where n is the rank score and N is the total number of observations.

For example, suppose I have three values: 10, 40, and 50. MS Excel calculates the percentiles as 0%, 50%, and 100%. Using the PROC RANK procedure, I get percentiles of 33%, 66% and 100% using the PERCENT option or 25%, 50%, and 75% using the NPLUS1 or GROUPS=100 option.

Am I missing something? Do I have to code this in a DATA step to get what I'm looking for?

For example, suppose I have three values: 10, 40, and 50. MS Excel calculates the percentiles as 0%, 50%, and 100%. Using the PROC RANK procedure, I get percentiles of 33%, 66% and 100% using the PERCENT option or 25%, 50%, and 75% using the NPLUS1 or GROUPS=100 option.

Am I missing something? Do I have to code this in a DATA step to get what I'm looking for?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-24-2009 08:00 PM

It would appear that you can call 10 the 0th or 25th percentile or anything in between and up to the 33rd. Which I suppose makes since with N=3.

[pre]

data have;

input y @@;

cards;

10 40 50

;;;;

run;

proc univariate noprint;

output out=pct PCTLPRE=pct PCTLPTS=0 to 100 by 1;

run;

proc transpose;

run;

proc print;

run;

[/pre]

[pre]

data have;

input y @@;

cards;

10 40 50

;;;;

run;

proc univariate noprint;

output out=pct PCTLPRE=pct PCTLPTS=0 to 100 by 1;

run;

proc transpose;

run;

proc print;

run;

[/pre]

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-25-2009 04:16 PM

I'm not sure I understand the utility of this solution. The output assigns the value 10 to all percentiles between 0% and 33%. I would expect the 10 value to be assigned just to 0%. Using the formula in my first post, the percentile would be 0% and not any other values. The second value, 40, would be assigned a percentile of 50%, not all the percentiles between 34% and 66%.