RECODE
Maps old values to new values, in place or into new variables.
Syntax
Section titled “Syntax”RECODE varlist (old = new) [(old = new) …] [INTO newlist] [/ varlist …].Synopsis
Section titled “Synopsis”| Kind | Transformation (pending until data is needed) |
| Body | free-form body |
| Changes data | yes, undoable |
Specifications
Section titled “Specifications”- value lists: 1, 2 = 1. Several old values separated by commas or spaces
- ranges: lo THRU hi, LO THRU x, x THRU HI
- MISSING / SYSMIS: user- or system-missing / system-missing only
- ELSE: all remaining values
- COPY: keep the old value
- CONVERT: turn digit strings into numbers
Examples
Section titled “Examples”RECODE age (LO THRU 17=1) (18 THRU 64=2) (65 THRU HI=3) (MISSING=SYSMIS) INTO agegrp.RECODE q1 TO q5 (1=5) (2=4) (4=2) (5=1).RECODE answer ('yes'=1) ('no'=0) INTO answer_n.- Specifications are evaluated left to right and the first match wins.
- Unmatched values stay unchanged when recoding in place, and become system-missing in a new variable.
Related
Section titled “Related”Generated from OrcStat’s command registry and reference. To suggest a change, open an issue.