BookmarkSubscribeRSS Feed
aman23
Obsidian | Level 7

What is percentile in SAS??? what are the different ways to calculate the same?? 

3 REPLIES 3
Reeza
Super User

Quantile and Related Statistics

The keywords for quantiles and related statistics are
MEDIAN
is the middle value.
P1
is the 1st percentile.
P5
is the 5th percentile.
P10
is the 10th percentile.
P90
is the 90th percentile.
P95
is the 95th percentile.
P99
is the 99th percentile.
Q1
is the lower quartile (25th percentile).
Q3
is the upper quartile (75th percentile).
QRANGE
is interquartile range and is calculated as
table with 1 row and 1 column , row1 column 1 , q sub 3 , minus , q sub 1 , end table
You use the QNTLDEF= option (PCTLDEF= in PROC UNIVARIATE) to specify the method that the procedure uses to compute percentiles. Let n be the number of nonmissing values for a variable, and letx sub 1 , comma , x sub 2 , comma dot dot dot comma , x sub n represent the ordered values of the variable such that x sub 1 is the smallest value, x sub 2 is next smallest value, and x sub n is the largest value. For the tth percentile between 0 and 1, let p equals t slash 1 0 0 . Then define j as the integer part of n p and g as the fractional part of n p or open n plus 1 close . p , so that
table with 2 rows and 2 columns , row1 column 1 , , column 2 n p equals j plus g , w h e n . q n t l d e f equals 1 comma 2 comma 3 comma o r 5 , row2 column 1 , , column 2 open n plus 1 close . p equals j plus g . w h e n q n t l d e f equals 4 , end table
Here, QNTLDEF= specifies the method that the procedure uses to compute the tth percentile, as shown in the table that follows.
When you use the WEIGHT statement, the tth percentile is computed as
table with 1 row and 1 column , row1 column 1 , y equals left brace . table with 2 rows and 2 columns , row1 column 1 , 1 half . open , x sub i , plus . x sub i plus 1 end sub . close , column 2 if . modified cap sigma with j equals 1 below and with i above . w sub j , equals p w , row2 column 1 , x sub i plus 1 end sub , column 2 if . modified cap sigma with j equals 1 below and with i above . w sub j , less than p w less than . modified cap sigma with j equals 1 below and with i plus 1 above . w sub j , end table , end table
where w sub j is the weight associated with x sub i and w equals . modified cap sigma with i equals 1 below and with n above . w sub i is the sum of the weights. When the observations have identical weights, the weighted percentiles are the same as the unweighted percentiles with QNTLDEF=5.
Methods for Computing Quantile Statistics
QNTLDEF=
Description
Formula
1
weighted average at x sub n p end sub
y equals . open 1 minus g close . x sub j , plus g . x sub j plus 1 end sub
 
where x sub o is taken to be x sub 1
2
observation numbered closest to n p
y equals , x sub i
if g not equal to , 1 half
y equals , x sub j
if g equals , 1 half and j is even
y equals . x sub j plus 1 end sub
if g equals , 1 half and j is odd
where i is the integer part of n p plus , 1 half
3
empirical distribution function
y equals , x sub j
if g equals 0
y equals . x sub j plus 1 end sub
if g greater than 0
4
weighted average aimed at x sub open n plus 1 close . p end sub
y equals . open 1 minus g close . x sub j , plus g . x sub j plus 1 end sub
 
where x sub n plus 1 end sub is taken to be x sub n
5
empirical distribution function with averaging
y equals , 1 half . open , x sub j , plus . x sub j plus 1 end sub . close
if g equals 0
y equals . x sub j plus 1 end sub
if g greater than 0

 

 

https://documentation.sas.com/?docsetId=proc&docsetTarget=p0v0y1on1hbxukn0zqgsp5ky8hc0.htm&docsetVer...

 


@aman23 wrote:

What is percentile in SAS??? what are the different ways to calculate the same?? 


 

Satish_Parida
Lapis Lazuli | Level 10

This Document Explains the Percentile.

http://support.sas.com/documentation/cdl/en/procstat/66703/HTML/default/viewer.htm#procstat_univaria...

 

Example:

data Heights(drop=i);
do i=1 to 1000;
	Height=round(ranuni(8)*100,.01);
	output;
end;
run;

title 'Analysis of Female Heights';
ods select Quantiles;
proc univariate data=Heights ciquantdf(alpha=.1);
   var Height;
run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1084 views
  • 5 likes
  • 4 in conversation