VARIABLES Subcommand (RANK command)
VARIABLES specifies the variables to be ranked.
-
VARIABLESis 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
Afor ascending (smallest value gets smallest rank) orDfor descending (largest value gets smallest rank).Ais the default. - To rank some variables in ascending order and others
in descending order, use both
AandDin the same variable list.AorDapplies to all preceding variables in the list up to the previousAorDspecification. - To organize ranks into subgroups, specify keyword
BYfollowed 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
AUTORECODEto recode string variables for ranking.
Examples
RANK VARIABLES=MURDERS ROBBERY (D).
-
RANKranks MURDERS and ROBBERY and creates two new variables in the active dataset: RMURDERS and RROBBERY. -
Dspecifies descending order of rank.Dapplies 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.