Chapter Contents

Previous

Next
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


Program

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
The group values pair up swimmers with similar times to work on each stroke. For example, Andrea and Ellen work together on the backstroke because they have the fastest times in the female class. The groups of male swimmers are unbalanced because there are seven male swimmers; for each stroke, one group has three swimmers. [HTML Output]
 [Listing Output]


Chapter Contents

Previous

Next

Top of Page

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