Login

Recoding Variables in SPSS Statistics

Introduction

The instructions below will show you how to recode variables. You can use recoding to produce different values or codes for a variable. Recoding can be done in one of two ways:

In this guide, we will concentrate on recoding into a different variable, for which there are 3 main types of recoding:

We will use an example of each type in order to demonstrate how to recode variables in SPSS Statistics.

Testimonials
TAKE THE TOUR


SPSS Statistics

Recode single values in SPSS Statistics

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 Statistics Data Editor and name the variable "Runs".
    Remember that each individual's results go on a separate line (row) in SPSS Statistics.
    Recoding Variables in SPSS

    Published with written permission from SPSS Statistics, IBM Corporation.

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

    Published with written permission from SPSS Statistics, IBM Corporation.

  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 Statistics, IBM Corporation.

  4. In the –Output Variable– area 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 Statistics, IBM Corporation.

  5. Click on 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 Statistics, IBM Corporation.

  7. Click on the SPSS Old and New Values Button button.
  8. Enter the first score (120) into the Value: box within the –Old Value– area, and set the new code of "1" into Value: box within the –New Value– area.
  9. Click on 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 Statistics, IBM Corporation.

  11. Click on the Continue button.
  12. You will have returned to the previous screen and will now have to click on 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 Statistics, IBM Corporation.

Join the 10,000s of students, academics and professionals who rely on Laerd Statistics.TAKE THE TOUR
next »