COMPUTE

COMPUTE creates new numeric variables or modifies the values of existing string or numeric variables.

COMPUTE target variable=expression

This command does not read the active dataset. It is stored, pending execution with the next command that reads the dataset. See the topic Command Order for more information.

Syntax for the COMPUTE command can be generated from the Compute Variable dialog.

Example

COMPUTE newvar1=var1+var2.
COMPUTE newvar2=RND(MEAN(var1 to var4).
COMPUTE logicalVar=(var1>5).
STRING newString (A10).
COMPUTE newString=CONCAT((RTRIM(stringVar1), stringVar2).

Functions and operators available for COMPUTE are described in .