Procedure features: |
PROC RANK statement options:
|
BY statement |
RANKS statement |
VAR
statement |
|
Other features: |
|
This example performs the following actions:
-
ranks observations separately within
BY groups
-
reverses the order of the ranks so that the highest value receives
the rank of 1
-
assigns the best possible rank to tied values
-
creates ranking variables and prints them with the original
variables
|
options nodate pageno=1 linesize=80 pagesize=60; |
|
data elect;
input Candidate $ 1-11 District 13 Vote 15-18 Years 20;
datalines;
Cardella 1 1689 8
Latham 1 1005 2
Smith 1 1406 0
Walker 1 846 0
Hinkley 2 912 0
Kreitemeyer 2 1198 0
Lundell 2 2447 6
Thrash 2 912 2
; |
|
proc rank data=elect out=results ties=low descending; |
|
by district; |
|
var vote years;
ranks VoteRank YearsRank;
run; |
|
proc print data=results n;
by district;
title 'Results of City Council Election';
run; |
|
Results of City Council Election 1
---------------------------------- District=1 ----------------------------------
Vote Years
Obs Candidate Vote Years Rank Rank
1 Cardella 1689 8 1 1
2 Latham 1005 2 3 2
3 Smith 1406 0 2 3
4 Walker 846 0 4 3
N = 4
---------------------------------- District=2 ----------------------------------
Vote Years
Obs Candidate Vote Years Rank Rank
5 Hinkley 912 0 3 3
6 Kreitemeyer 1198 0 2 3
7 Lundell 2447 6 1 1
8 Thrash 912 2 3 2
N = 4
| |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.