Proc Rank

Contents Index


Proc rank computes the ranks of the values of numeric variables. The ranks can then be used to conduct nonparametric statistical tests, among other uses. See also proc univariate and proc npar1way for conducting nonparametric tests. Example:

proc rank
	data=stuff
	out=newstuff	/* highly recommended */
	descending
	fraction
	ties=high;
ranks rankedx rankedy;
var x y;
run;

The data= option specifies the SAS data set containing the variables for which ranks are to be computed. If not specified the ranks will be placed in a data set named DATAn where n is an integer.

The out= option specifies the name of the SAS data set that will contain the ranks.

The descending option creates rankings with the largest value having rank 1. The default gives the smallest value rank 1.

The fraction option divides each rank by the number of nonmissing values taken by the variable.

The ties= option determines how tied values are assigned ranks. The default ties=mean uses midranks; ties=low uses the smallest of the corresponding ranks; ties=high uses the largest of the corresponding ranks. Using ties=high together with the fraction option produces the values of the empirical distribution function of the sample.

The ranks statement assigns names to the variables holding the ranks of variables listed in the var statement. The first name in the ranks statement is the name of the variable in the out= data set which holds the ranks of the first variable in the var statement, and so on. If the ranks statement is NOT used the variable names in the original data set are used as the names of variables in the out= data set with the values replaced by the ranks.

The var statement specifies the variables in the SAS data set for which ranks are to be computed. If omitted, all numeric variables in the data set are ranked. Variables not listed in the var statement are passed unchanged to the out= data set. If the ranks statement is NOT used the variable names in the original data set are used as the names of variables in the out= data set with the values replaced by the ranks. If the ranks statement is used the var statement MUST be used.

Other options are available to compute normal scores and Savage (exponential) scores. A by statement can also be used. For further information see the SAS Procedures Guide.


Contents Index

Copyright © 1997 by Jerry Alan Veeh. All rights reserved.