College of Natural Sciences
 
FAQs
This is for IE7 to hold div open

SAS FAQ #15: Percentile ranks with SAS

Question:

How can I generate percentile ranks using SAS?

Answer:

Use the GROUPS= option for PROC RANK to get percentile (and other x-ile) ranks. The following code stores the percentile ranks for the variables named V1 and V2 in the variables named PRV1 and PRV2.

PROC RANK GROUPS=100 OUT=permsas.dataset;
VAR v1 v2;
RANKS prv1 prv2;
RUN;

Notes on the code:

1. Output: The OUT= option for the PROC RANK statement must be used if you want to create a permanent SAS dataset containing the ranking variables (here PRV1 and PRV2).

2. Output: The RANKS statement must be used if you want to include the original variables in the output dataset, and the VAR statement must be used if the RANKS statement is used. The RANKS statement assigns names to the new variables containing the ranks; the nth name contains the ranks for the nth variable listed in the VAR statement.

3. Other ranks: Use the GROUPS= option to obtain other x-ile ranks. E.g., to obtain quartile (decile) ranks, specify GROUPS=4 (10).

For more information on ranking data, click on the Help button in the SAS menu bar and scroll to SAS Help and Documentation.

If you have further questions, send E-mail to stats@ssc.utexas.edu.