Numeric Variables (RECODE command)
- Target variables can be existing or new variables. For existing variables, cases with values not mentioned in the value specifications are not changed. For new variables, cases with values not mentioned are assigned the system-missing value.
- New numeric variables have default print and write
formats of
F8.2
(or the format specified onSET FORMAT
).
Recoding a Single Variable Into a Target Variable
RECODE AGE (MISSING=9) (18 THRU HI=1) (0 THRU 18=0) INTO VOTER.
- The recoded AGE values are stored in target variable VOTER, leaving AGE unchanged.
- Value 18 and higher values are changed to value 1.
Values between 0 and 18, but not including 18, are recoded to 0. If
the specification
0 THRU 18
preceded the specification18 THRU HI
, value 18 would be recoded to 0.
Recording Multiple Variables Into Target Variables
RECODE V1 TO V3 (0=1) (1=0) (2=-1) INTO DEFENSE WELFARE HEALTH.
- Values for V1 through V3 are recoded and stored in DEFENSE, WELFARE, and HEALTH. V1, V2, and V3 are not changed.