You can compute new variables based on highly complex equations, utilizing a wide variety of mathematical functions. In this example, however, we will simply compute a new variable that is the difference between the values of two existing variables.

The data file demo.sav contains a variable for respondent's current age and a variable for number of years at current job. It does not, however, contain a variable for the respondent's age at the time he or she started that job. We can create a new variable that is the computed difference between current age and number of years at current job -- which should be the approximate age at which the respondent started that job.

From the menus in the Data Editor window choose:

Transform
Compute

For Target Variable, enter jobstart.

Select Age in years (age) in the source variable list and click the arrow button to copy it to the Numeric Expression.

Click the minus (-) button on calculator pad in the dialog box (or the minus key on the keyboard).

Select Years with current employer (employ) and click the arrow button to copy it to the expression.

Click OK to compute the new variable.

The new variable is displayed in the Data Editor. Since the variable is added to the end of the file, it is displayed in the far right column in Data view and in the last row in Variable view.