Previous Page | Next Page

The RANK Procedure

Example 3: Partitioning Observations into Groups Based on Ranks


Procedure features:

PROC RANK statement option:

GROUPS=

BY statement

VAR statement

Other features:

PRINT procedure

SORT procedure


This example performs the following actions:


Program

 Note about code
options nodate pageno=1 linesize=80 pagesize=60;
 Note about code
data swim;
   input Name $ 1-7 Gender $ 9 Back 11-14 Free 16-19;
   datalines;
Andrea  F 28.6 30.3
Carole  F 32.9 24.0
Clayton M 27.0 21.9
Curtis  M 29.0 22.6
Doug    M 27.3 22.4
Ellen   F 27.8 27.0
Jan     F 31.3 31.2
Jimmy   M 26.3 22.5
Karin   F 34.6 26.2
Mick    M 29.0 25.4
Richard M 29.7 30.2
Sam     M 27.2 24.1
Susan   F 35.1 36.1
;
 Note about code
proc sort data=swim out=pairs;
   by gender;
run;
 Note about code
proc rank data=pairs out=rankpair groups=3;
 Note about code
   by gender;
 Note about code
   var back free;
run;
 Note about code
proc print data=rankpair n;
   by gender;
   title 'Pairings of Swimmers for Backstroke and Freestyle';
run;

Output: Listing

 Note about figure
               Pairings of Swimmers for Backstroke and Freestyle               1

----------------------------------- Gender=F -----------------------------------

                         Obs    Name      Back    Free

                           1    Andrea      0       1 
                           2    Carole      1       0 
                           3    Ellen       0       1 
                           4    Jan         1       2 
                           5    Karin       2       0 
                           6    Susan       2       2 

                                     N = 6


----------------------------------- Gender=M -----------------------------------

                         Obs    Name       Back    Free

                           7    Clayton      0       0 
                           8    Curtis       2       1 
                           9    Doug         1       0 
                          10    Jimmy        0       1 
                          11    Mick         2       2 
                          12    Richard      2       2 
                          13    Sam          1       1 

                                     N = 7

Previous Page | Next Page | Top of Page