SAVE TEMPLATE Subcommand (AUTORECODE command)

The SAVE TEMPLATE subcommand allows you to save the autorecode scheme used by the current AUTORECODE command to an external template file, which you can then use when autorecoding other variables using the APPLY TEMPLATE subcommand.

  • SAVE TEMPLATE is followed by an equals sign (=) and a quoted file specification. The default file extension for autorecode templates is .sat.
  • The template contains information that maps the original nonmissing values to the recoded values.
  • Only information for nonmissing values is saved in the template. User-missing value information is not retained.
  • If more than one variable is specified on the VARIABLES subcommand, the first variable specified is used for the template, unless GROUP or APPLY TEMPLATE is also specified, in which case a common autorecoding scheme for all variables is saved in the template.

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
  /SAVE TEMPLATE='/temp/var1_template.sat'.
  • The saved template contains an autorecode scheme that maps the string values of "a" and "b" from var1 to the numeric values 1 and 2, respectively.
  • The template contains no information for the value of "c" for var1 because it is defined as user-missing.
  • The template contains no information for values associated with var2 because the GROUP subcommand was not specified.