Posted by: tonyteaching | February 21, 2010

to Compute Variables (SPSS)

Computing Variables

Use the Compute dialog box to compute values for a variable based on numeric transformations of other variables.

• You can compute values for numeric or string (alphanumeric) variables.

• You can create new variables or replace the values of existing variables. For new variables, you can also specify the variable type and label.

• You can compute values selectively for subsets of data based on logical conditions.

• You can use a large variety of built-in functions, including arithmetic functions, statistical functions, distribution functions, and string functions.


From the menus choose:

Transform > Compute Variable

Type the name of a single target variable. It can be an existing variable or a new variable to be added to the active dataset.

To build an expression, either paste components into the Expression field or type directly in the Expression field.

• You can paste functions or commonly used system variables by selecting a group from the Function group list and double-clicking the function or variable in the Functions and Special Variables list (or select the function or variable and click the arrow adjacent to the Function group list). Fill in any parameters indicated by question marks (only applies to functions). The function group labeled All provides a listing of all available functions and system variables. A brief description of the currently selected function or variable is displayed in a reserved area in the dialog box.

• String constants must be enclosed in quotation marks or apostrophes.

• If values contain decimals, a period (.) must be used as the decimal indicator.

• For new string variables, you must also select Type & Label to specify the data type.


  1. Hello,

    Is it possible to compute a new variable based on the values of TWO other variables.. so for example.. if Variable A=<10 AND Variable B=<20= NEW VARIABLE. I'm sure this should be easy in SPSS and I'm familier with recoding values for one variable but this has me stumped! Can you help?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: