SPSS » Getting to Know SPSS » Recoding Variables

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
  1. 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.

    Recoding Variables in SPSS

    Published with written permission from SPSS Inc, an IBM Company.

  2. Click on Transform > Recode Into Different Variables... in the top menu.
    Recoding Variables in SPSS

    Published with written permission from SPSS Inc, an IBM Company.

  3. You need to highlight the "Runs" variable in the left-hand box by clicking on it and then click the SPSS Right Arrow Button button to move it across to the "Numeric Variable -> Output Variable:" box.
    Recoding Variables in SPSS

    Published with written permission from SPSS Inc, an IBM Company.

  4. 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 Red Arrow).
    Recoding Variables in SPSS

    Published with written permission from SPSS Inc, an IBM Company.

  5. Click the SPSS Change Button button.
  6. You should now see that the "Numeric Variable -> Output Variable:" box has now changed to reflect these changes (see the Red Arrow).
    Recoding Variables in SPSS

    Published with written permission from SPSS Inc, an IBM Company.

  7. Click the SPSS Old and New Values Button button.
  8. Enter the first score (120) into the "Old Value" box and set the new code of "1" into the "New Value".
  9. Click the SPSS Add Button button.
  10. Repeat for all other values such that you are presented with the following screen:
    Recoding Variables in SPSS

    Published with written permission from SPSS Inc, an IBM Company.

  11. Click the SPSS Continue Button button.
  12. You will have returned to the previous screen and will now have to click the SPSS OK Button 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:
    Recoding Variables in SPSS

    Published with written permission from SPSS Inc, an IBM Company.

Share to Facebook Email to a Friend Share to Twitter Stumble It Delicious Digg This Yahoo MySpace Reddit
Other Laerd Websites Laerd Mathematics Laerd Referencing Laerd Dissertation