Chapter Contents

Previous

Next
The RANK Procedure

Overview

The RANK procedure computes ranks for one or more numeric variables across the observations of a SAS data set and outputs the ranks to a new SAS data set. PROC RANK by itself produces no printed output.

Assignment of the Lowest Rank Value to the Lowest Variable Value shows the results of ranking the values of one variable with a simple PROC RANK step. In this example, the new ranking variable shows the order of finish of five golfers over a four-day competition. The player with the lowest number of strokes finishes in first place. The following statements produce the output:

proc rank data=golf out=rankings;
   var strokes;
   ranks Finish;
run;

proc print data=rankings;
run;

Assignment of the Lowest Rank Value to the Lowest Variable Value
[HTML Output]  [Listing Output]

In Assignment of the Lowest Rank Value to the Highest Variable Value within Each BY Group , the candidates for city council are ranked by district according to the number of votes that they received in the election and according to the number of years that they have served in office.

This example shows how PROC RANK can

For an explanation of the program that produces this report, see Ranking Values within BY Groups .

Assignment of the Lowest Rank Value to the Highest Variable Value within Each BY Group
[HTML Output]  [Listing Output]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.