Recoding Variables in SPSS
The instructions below will show you how to recode variables in SPSS 14.0. You can use recoding to produce different values or codes for a variable. Recoding can be done in one of two ways:
- Recoding into the same variable
- Recoding into a different variable
In this guide we will concentrate on recoding into a different variable for which there are 3 main types of recoding:
- Recode single values
- Recode a given range of values
- Recode data into two categories
We will use an example of each type in order to demonstrate how to recode variables in SPSS.
Recode single values
Example: The data given below represents runs scored by 5 batsmen in a national-level match. Recode the data so that the batsmen are rank ordered by their number of runs, with the batsman with the highest runs given a code of "1" and the batsman with the lowest runs given a "5".
| Number of runs by batsmen | |||||
| Batsmen | 1 | 2 | 3 | 4 | 5 |
| Runs | 86 | 120 | 56 | 10 | 18 |
- Enter the data in the SPSS Data Editor and name the variable "Runs".
Remember that each individual's results go on a separate line (row) in SPSS.
- Click on Transform > Recode Into Different Variables... in the top menu.
- You need to highlight the "Runs" variable in the left-hand box by clicking on it and then click the
button to move it across to the "Numeric Variable -> Output Variable:" box.
- In the Output Variable grouping show below, give the new variable you are about to create a name and label. In this example, we have named the new variable "Ranked-Runs" and the label as "Ranked Runs" (see the
).
- Click the
button. - You should now see that the "Numeric Variable -> Output Variable:" box has now changed to reflect these changes (see the
).
- Click the
button. - Enter the first score (120) into the "Old Value" box and set the new code of "1" into the "New Value".
- Click the
button. - Repeat for all other values such that you are presented with the following screen:
- Click the
button. - You will have returned to the previous screen and will now have to click the
button. This will take you to the Data View Editor which will now show that you have created a new variable that is based on recoding your existing variable:










