Post by Adam Smith
I am quite new to SPSS and I would like to replace the value 999 by 99999 across all my variables. The SPSS dialog "Find & Replace" works for one column/variable at a time only. Can someone help out with a script to make replacement across all variables possible?
RECODE ought to do the trick. How efficient you can make the code depends on whether there are any string variables, whether all numeric variables are contiguous in the file, etc. Here's a simple example to get you started.
DATA LIST LIST / x1 x2 x3 (3F8.0).
1 2 4
999 999 999
* If all variables are numeric, use keyword ALL.
RECODE ALL (999 = 999999).
* If there is at least one string variable, but numeric variables are contiguous, use keyword TO.
RECODE x1 to x3 (999 = 999999).
* If numeric variables are not contiguous, list them, but bear in mind you can use TO
* in stretches where they are contiguous.
RECODE x1 TO x2 x3 (999 = 999999).
* If all numeric variables are surrounded by string variables, list each variable.
RECODE x1 x2 x3 (999 = 999999).