RANK Procedure

Tips: You can use the ATTRIB, FORMAT, LABEL, and WHERE statements with the RANK procedure. For more information, see Statements with the Same Function in Multiple Procedures. You can also use any global statement. For a list, see Global Statements in SAS Statements: Reference.

For in-database processing to occur, your data must reside within a supported version of the DBMS that has been properly configured for SAS in-database processing. For more information, see In-Database Processing for PROC RANK.


PROC RANK <option(s)>;
BY <DESCENDING> variable-1
<…<DESCENDING> variable-n>
VAR data-set-variables(s);
RANKS new-variables(s);

Table of Procedure Tasks

Statement Task Example
PROC RANK Statement Compute the ranks for one or more numeric variables in a SAS data set and outputs the ranks to a new SAS data set Ex. 1, Ex. 2, Ex. 3
BY Statement Calculate a separate set of ranks for each BY group Ex. 2, Ex. 3
RANKS Statement Identify a variable to which the ranks are assigned Ex. 1, Ex. 2
VAR Statement Specify the variables to rank Ex. 1, Ex. 2, Ex. 3