GROUP Subcommand (AUTORECODE command)

The subcommand GROUP allows you to specify that a single autorecoding scheme should be generated for all the specified variables, yielding consistent coding for all of the variables.

  • The GROUP subcommand has no additional keywords or specifications. By default, variables are not grouped for autorecoding.
  • All variables must be the same type (numeric or string).
  • All observed values for all specified variables are used to create a sorted order of values to recode into sequential integers.
  • String variables can be of any length and can be of unequal length.
  • User-missing values for the target variables are based on the first variable in the original variable list with defined user-missing values. All other values from other original variables, except for system-missing, are treated as valid.
  • If only one variable is specified on the VARIABLES subcommand, the GROUP subcommand is ignored.
  • If GROUP and APPLY TEMPLATE are used on the same AUTORECODE command, value mappings from the template are applied first. All remaining values are recoded into values higher than the last value in the template, with user-missing values (based on the first variable in the list with defined user-missing values) recoded into values higher than the last valid value. See the APPLY TEMPLATE subcommand for more information.

Example

DATA LIST FREE /var1 (a1) var2 (a1).
BEGIN DATA
a d
b e
c f
END DATA.
MISSING VALUES var1 ("c") var2 ("f").
AUTORECODE VARIABLES=var1 var2
  /INTO newvar1 newvar2
  /GROUP.
  • A single autorecoding scheme is created and applied to both new variables.
  • The user-missing value "c" from var1 is autorecoded into a user-missing value.
  • The user-missing value "f" from var2 is autorecoded into a valid value.
Table 1. Original and recoded values
Original value Autorecoded value
a 1
b 2
c 6 (user-missing)
d 3
e 4
f 5