Interaction between APPLY TEMPLATE and SAVE TEMPLATE (AUTORECODE command)

  • If APPLY TEMPLATE and SAVE TEMPLATE are both used in the same AUTORECODE command, APPLY TEMPLATE is always processed first, regardless of subcommand order, and the autorecode scheme saved by SAVE TEMPLATE is the union of the original template plus any appended value definitions.
  • APPLY TEMPLATE and SAVE TEMPLATE can specify the same file, resulting in the template being updated to include any newly appended value definitions.

Example

AUTORECODE VARIABLES=products
 /INTO productCodes
 /APPLY TEMPLATE='/mydir/product_codes.sat'
 /SAVE TEMPLATE='/mydir/product_codes.sat.
  • The autorecode scheme in the template file is applied for autorecoding products into productCodes.
  • Any data values for products not defined in the template are autorecoded into values higher than the highest value in the original template.
  • Any user-missing values for products are autorecoded into values higher than the highest nonmissing autorecoded value.
  • The template saved is the autorecode scheme used to autorecode product--the original autorecode scheme plus any additional values in product that were appended to the scheme.