VARIABLES Subcommand (RANK command)
VARIABLES
specifies the variables to be ranked.
-
VARIABLES
is required and must be the first specification onRANK
. The minimum specification is a single numeric variable. To rank more than one variable, specify a variable list. - After the variable list, you can specify the direction
for ranking in parentheses. Specify
A
for ascending (smallest value gets smallest rank) orD
for descending (largest value gets smallest rank).A
is the default. - To rank some variables in ascending order and others
in descending order, use both
A
andD
in the same variable list.A
orD
applies to all preceding variables in the list up to the previousA
orD
specification. - To organize ranks into subgroups, specify keyword
BY
followed by the variable whose values determine the subgroups. The active dataset does not have to be sorted by this variable. - String variables cannot be specified. Use
AUTORECODE
to recode string variables for ranking.
Examples
RANK VARIABLES=MURDERS ROBBERY (D).
-
RANK
ranks MURDERS and ROBBERY and creates two new variables in the active dataset: RMURDERS and RROBBERY. -
D
specifies descending order of rank.D
applies to both MURDERS and ROBBERY.RANK VARIABLES=MURDERS (D) ROBBERY (A) BY ETHNIC.
- Ranks are computed within each group defined by ETHNIC. MURDERS is ranked in descending order and ROBBERY in ascending order within each group of ETHNIC. The active dataset does not have to be sorted by ETHNIC.