4.6 COMPUTE

@COMPUTE returns the value of an arithmetic expression to a target column. The value returned from the function is in the form of a string.

You can omit @COMPUTE when returning the value of an arithmetic expression to another function.

Syntax

@COMPUTE (value operator value)
value

One or more values on which you are performing calculations.

operator

A valid arithmetic or logical operator.

Examples

Example 1   

This example adds AMT and AMT2 and returns the total to AMOUNT_TOTAL.

AMOUNT_TOTAL = @COMPUTE (AMT + AMT2)
Example 2   

This example is invalid because the expression is not enclosed in parentheses.

AMOUNT_TOTAL = AMT + AMT2