Recoding Categorical Variables
Table 1
Table
6 / 10
Table 1
Table
Table 1
| Recoding situation | Example | Preferred practice |
|---|---|---|
| Numeric codes to labels | `1`, `2`, `3` to sex labels | Use data dictionary and preserve original variable |
| Text standardization | `done`, `Complete`, `completed` | Create cleaned variable and review free text source |
| Unexpected values | Code `9` appears but is not defined | Flag for review rather than silently dropping |
| Checkbox variables | Multiple binary columns for symptoms | Keep raw checkbox fields and derive summary variables |
| Site names | `Kilifi`, `Kilifi Hosp`, `KWTRP` | Use controlled site lookup table |