SPSS offers two choices under the recode command: Into Same Variable and Into Different Variables.
The command Into Same Variable replaces existing data with new values, but the command Into Different Variables adds a new variable to the data set.
In almost every situation, you want to use Into Different Variables. Recoding Into Same Variables replaces the values in the existing variable.
So if you notice a mistake after you’ve recoded, you can’t fix it.
But you may not even notice the mistake, because you can’t even test it.
And that’s just dangerous.
So do not recode over an existing variable unless you are absolutely certain that the lost information will never be needed.
Here is an example of how to do it in the menus. This is from the General Social Survey data set that comes along with SPSS. In it, I am recoding Educ, Years of Education, into 5 categories: Less than High School, High School Grad, Some College, Bachelor’s degree, More than college.
Recode Into Different Variables
This dialog window will come up:
I filled in the following:
Numeric variable: Educ
Output variable Name: Educ_Cat
Output variable Label: Education in Categories
Click Old and New Values
This Dialogue Window will pop up:
Fill in the following:
Old Value: Range: Lowest Through: 11
New Value: Value: 1
Old Value: Value 12
New Value: Value: 2
Old Value: Range: 13 Through: 15
New Value: Value: 3
Old Value: Value: 16
New Value: Value: 4
Old Value: Range: 17 Through Highest
New Value: Value: 5
Old Value: System- or User-Missing
New Value: System Missing
Or, you could do all of that in just a few lines of very logical syntax code:
RECODE educ (12=2) (16=4) (MISSING=SYSMIS) (Lowest thru 11=1) (13 thru 15=3) (17 thru Highest=5) INTO Educ_cat.
VARIABLE LABELS Educ_cat ‘Education in Categories’.
If you don’t have many variables to recode, say one or two, it’s not a big deal to use the menus (but at least paste the code, so you have a record of what you did later!).
But if you have more than just one or two, all those mouse-clicks get old, fast.
And if you need to go back and change your coding scheme, say to combine two small categories, it’s a quick matter to update the code. In the menus you have to start over.
Want to learn more? If you’re just getting started with data analysis in SPSS, or would like a thorough refresher, please join us in our online workshop Introduction to Data Analysis in SPSS.