How do you recode variables in SPSS with an example?

Recoding variables in SPSS refers to the process of changing the values of a variable to different numerical or categorical values. This is often done to simplify data analysis or to group data into different categories. For example, if a survey question asks for the respondent’s age in years, it might be more useful to recode this variable into age groups (e.g. 18-25, 26-35, etc.) for analysis. To recode variables in SPSS, you can use the “Recode” function under the “Transform” menu. You can then specify the old and new values for each category and create a new variable with the recoded values.


Often you may want to recode the values of certain variables in SPSS.

For example, you may want to recode all “Yes” values to 1 and all “No” values to 0 for a certain variable.

The easiest way to recode variables in SPSS is to use Transform > Recode into Same Variables.

The following example shows how to do so in practice.

Example: How to Recode Variables in SPSS

Suppose we have the following dataset in SPSS that contains information about various basketball players:

Suppose that we would like to recode each Yes to 1 and each No to 0 in the AllStar column.

To do so, click the Transform tab, then click Recode into Same Variables:

Note: If you would rather create a new variable that contains these recoded values then you can instead click Recode into Different Variables.

In the new window that appears, drag the AllStar variable into the String Variables box:

Then click the Old and New Values button.

In the new window that appears, type Yes into the Old Value box and then type 1 into the New Value box, then click the Add button:

Then type No into the Old Value box and then type 0 into the New Value box, then click the Add button:

recode values in SPSS

These two new recoding rules will be shown in the Old –> New box.

Lastly, click Continue. Then click OK.

The Yes and No values will now be shown as 1 and 0, respectively, in the AllStar column:

Note that in this example we only recoded two values, but you can use this same process to recode as many values as you’d like for your own variables.

Additional Resources

The following tutorials explain how to perform other common operations in SPSS:

x