Last modified on 29 June 2010, at 02:59

Using SPSS and PASW/Computing Variables

Computing variables in SPSS basically refers to modifying existing variables mathematically to create new variables. Possible computations include adding, subtracting, dividing, or multiplying existing variables, along with many more options. The goal, of course, is to manipulate one or more variables to form a new variable with that data. One of the most common reasons for using the “compute variable” command in SPSS is to create a scale measure that combines several existing variables into a single variable. Scale measures often do a better job capturing the phenomenon of interest.

In this chapter an abortion attitudes scale is created by combining a set of questions that people were asked about abortion (e.g., Do you think a woman should be allowed to obtain an abortion if: she has been raped, she doesn't want anymore kids, etc.?). While the individual questions are useful for gaining a sense of people's views on whether or not abortion should be legal in specific cases, by combining the variables it is possible to get a better sense of peoples' overall views toward abortion.

To compute variables, select: “Transform” → “Compute Variable”:

10computingvariables01.png

The resulting window allows you to run computations on existing variables to create a new variable.

10computingvariables02.png

On the left, under “Target Variable,” you can provide a name for your new variable. Under “Numeric Expression,” you can build a formula using mathematical operators and the variables in your data set. To move variables into the “Numeric Expression” box, highlight the variable you want, and then use the arrow key to move it over to the box. Use the keypad and list to the right of the keypad to combine the variables how you like.

For the example, seven variables are being combined to create a new scale: abscale. To do this all the abortion variables are added to the “Numeric Expression” box and added together, as shown above. Once you're done, hit “OK.”

After hitting “OK,” if you look in the Data Editor under “Variable View,” your new variable “abscale,” will appear at the very bottom.

10computingvariables03.png

You'll notice that there is no “Label” and your “Values” are listed as “None.” Whenever you compute a variable, you should immediately add a descriptive label (e.g., views on abortion; should range from 0 to 7).

In order to ensure that you created the scale accurately, you can check the frequencies and/or descriptives. Select “Analyze” → “Descriptive Statistics” → “Frequencies”:

10computingvariables04.png

You will get a window like this:

10computingvariables05.png

Select your newly created variable, use the arrow to put it into the “Variable” box, and click okay.

In your Output Window you will see a frequency distribution table for your new variable.

10computingvariables06.png

Following these steps, you can create new variables using a myriad of mathematical computations and check to make sure it was accurately computed.

Chapter contributed by Gen Guzman.