Usage Note 22759: What percentile is each observation in, and how can I create a variable that indicates the percentile that each observation is in?
Use the RANK procedure that is documented in the SAS Procedures Guide for this. For example, specify the GROUPS=100 option for percentile ranks, GROUPS=4 for quartile ranks, and GROUPS=10 for decile ranks.
The following statements create a variable, RANK_Y, that indicates the percentile (values 0 to 99) that each value of the original variable, Y, falls into. The input data set, A, is copied to the OUT= data set RANKED_A with RANK_Y included. Note that you can create ranks for multiple variables in one run of PROC RANK. Simply list all of the variables that you want to rank in the VAR statement and the names for each of the new rank variables in the RANKS statement. If you omit the RANKS statement, then the original variable values are replaced by ranks in the OUT= data set.
proc rank data=a groups=100 out=ranked_a;
var y;
ranks rank_y;
run;
Operating System and Release Information
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Type: | Usage Note |
Priority: | low |
Topic: | Analytics SAS Reference ==> Procedures ==> RANK SAS Reference ==> Procedures ==> MEANS SAS Reference ==> Procedures ==> SUMMARY Analytics ==> Transformations SAS Reference ==> Procedures ==> UNIVARIATE Analytics ==> Nonparametric Analysis
|
Date Modified: | 2019-06-10 09:12:01 |
Date Created: | 2002-12-16 10:56:36 |