Numeric expressions

Numeric expressions play a central role in transformations (COMPUTE). This document describes numeric expressions for the purpose of this tutorial; for a full list of all available functions and operators you should refer to the SPSS documentation.

presents a complex dialog that lets you

1. Define a Target variable, i.e. the variable for which you want to compute new values.
2. Compose a numeric expression of any complexity, either by typing it directly into the Numeric expression field or by composing it
• Select a variable in the list and transfer the variable name using the buttons
• Use the buttons to enter operators and numbers
• Functions and Special Variables Add a function: Browse through the available functions (when selection a function SPSS displays a short description).

The button shown below the Target variable can be used to add a label to the new variable. By default SPSS creates numeric variables. to go back to the main dialog.

When done click to execute the command. No further message will be displayed if SPSS accepted the command. As this is a do not expect any further output as SPSS just produces the new variable. If you want to "see" what SPSS produced you either can check the to look up the new variable, or - usually better - to produce some statistics or graphs using the newly created variable. By the way it is also a good idea to check whether the newly created variable looks as it should (plausibility check).

[Technical detail; depending upon default settings you may or may not experience this] If you look up the before producing any statistics or graph you might be surprised to see that the corresponding data column just contains ".". If at the same time you see Transformations pending on the status line, this simply means that the variable has not been created yet (SPSS waits until the variable is actually needed for analysis (i.e. a statistical/graphical command requires data). If this is the case and you want to see the new values use to execute the transformations at this stage.

Make sure to understand that you might compose invalid expressions that SPSS diagnoses when you attempt to execute the command by clicking . Here's a collection of some of the messages you might get. To avoid these errors and to be able to correct them, understanding the rules of writing correct expressions is essential.

Correct the expression and try again....

Further details