Syntax Rules (RECODE command)

  • The variables to be recoded must already exist and must be specified before the value specifications.
  • Value specifications are enclosed in parentheses. The original value or values must be specified to the left of an equals sign. A single new value is specified to the right of the equals sign.
  • Multiple values can be consolidated into a single recoded value by specifying, to the left of the equals sign, a list of values separated by blanks or commas. Only one recoded value per set is allowed to the right of the equals sign.
  • Multiple sets of value specifications are permitted. Each set must be enclosed in parentheses and can result in only one new value.
  • To recode multiple variables using the same set of value specifications, specify a variable list before the value specifications. Each variable in the list is recoded identically.
  • To recode variables using different value specifications, separate each variable (or variable list) and its specifications from the others by a slash.
  • Original values that are not specified remain unchanged unless the keyword ELSE or INTO is used to recode into a new variable. ELSE refers to all original values not previously mentioned, including the system-missing value. ELSE should be the last specification for the variable. When recoding INTO another variable, unspecified values are set to system-missing or blank for strings.
  • COPY replicates original values without recoding them.
  • INTO is required to recode a string variable into a numeric variable or a numeric variable into a string variable.