SPSS Compute Variable

SPSS Tutorial (for Beginners): Intro to SPSS

About the SPSS Compute Variable Function

Sometimes you may have a data set that doesn’t give you the specific statistic you need. For example, you may have two counts for debt from credit cards and “other”, but you are more interested in the total debt. Or, you may want to know the average score for a particular set of variables. SPSS has a built in calculator that you can access in the Transform meu. SPSS Compute Variable works just like a mini calculator within the SPSS windows. It will add, subtract, find averages, and perform a whole host of other arithmetic functions. Once SPSS has calculated the result, it will return those results in a new column at the end of the existing data. Here’s how to use the compute variables function.


Watch the video for two examples (addition and finding the mean):

Step 1: Click “Transform”, then click “Compute Variable”.

spss compute variable
The SPSS compute variable window.

Step 2: Give your new (target) variable name. This can be anything you like, but make sure to adhere to SPSS naming conventions for variables.
Step 3: Type in your request. For example, let’s say you wanted to add two variables:

  1. Move one variable over to the “Numeric Expression” box.
  2. Press the addition button (+) on the calculator.
  3. Move the second variable over to “Numeric Expression” box.

Step 4: Click OK.
Step 5: Close the execution window by clicking the “x” in the top right.

Note: If the OK button is greyed out (an easy mistake to make), make sure that you have specified a Target Variable name in the top left. Unlike entering data into Data View, SPSS won’t create a variable name (like “Default”) with the compute option. You must type in a name yourself for the program to run.

Comments? Need to post a correction? Please Contact Us.