RECODE

RECODE changes, rearranges, or consolidates the values of an existing variable.

For numeric variables:

RECODE varlist (value list=newvalue)...(value list=newvalue) [INTO varlist]
       [/varlist...]

Input keywords:

LO, LOWEST, HI, HIGHEST, THRU, MISSING, SYSMIS, ELSE

Output keywords:

COPY, SYSMIS

For string variables:

RECODE varlist [('string',['string'...]='newstring')][INTO varlist]
       [/varlist...]

Input keywords:

CONVERT, ELSE

Output keyword:`

COPY

This command does not read the active dataset. It is stored, pending execution with the next command that reads the dataset. See the topic Command Order for more information.

Syntax for the RECODE command can be generated from the Recode into Same Variables dialog or the Recode into Different Variables dialog.

Examples

RECODE V1 TO V3 (0=1) (1=0) (2,3=-1) (9=9) (ELSE=SYSMIS).
 
RECODE STRNGVAR ('A','B','C'='A')('D','E','F'='B')(ELSE=' ').