Formulas 

Use

Within a set, you can use formulas to perform calculations.

You can use a formula in a set and instruct the system to subtract a set line from another set line. When you use the set to define report columns, the system calculates a variance column in the report.

A formula consists of operators, operands, absolute values, and parentheses.

You can use formulas in any basic set or data set; you cannot use formulas in a single-dimension or multi-dimension set.

Features

Rules for Creating Formulas

Operators in Formulas

Symbol

Operator

+

Addition

-

Subtraction

*

Multiplication

/

Division

* *

Exponential value

( )

Parentheses

SIN

Sine

COS

Cosine

TAN

Tangent

SQRT

Square root

TRUNC

Truncation to integer

INT

Truncation to integer

DIV

Quotient of whole number division

MOD

Remainder of whole number division

ABS

Absolute value

EXP

Exponential function (nx)

LOG

Logarithm

ROUND

Rounding

 

Beginning with Release 3.0C, the syntax used to enter formula operands has changed. You enter formula operands in the form ‘nnn’ (for example, ‘001’ to enter the set line 001). In releases prior to Release 3.0C, you enter formula operands using angle brackets around the operand (for example, <001> ).

The system automatically converts existing formulas into the new format. You do not therefore need to change your sets that contain formulas.

You enter the following formula in the second line of a set defined for a report column:

IF ‘001’ > 1000 THEN ‘001’ ELSE 0

If the value in the first report column (set line 001) is greater than 1000, then this value is displayed in the second column; if the value in the first column is less than 1000, the value 0 is displayed in the second column.

For more information, see Introduction to Boolean Logic .

You enter the formula ‘001’ + ‘002’ in set line 003 to add together set lines 001 and 002.

You want to enter a second formula (set line 004) to calculate 50% of the total of set lines 001 and 002. You do so by entering the formula ‘003’ / 2 . The operand ‘003’ in this formula refers to the result of the formula calculated in set line 003.

You enter formulas in a set on the Create/Change Set: Basic Entries screens. For more information about entering a formula in a basic or data set, see Entering Value and Formula Variables in a Set .

Using Formulas in Formula Variables

You can create variables called formula variables, which determine the value for a variable.

You can use the operators in the previous table for a formula variable.

In your formula, you can also use:

The variables you use must use the same table name that you entered for the formula variable.

When you enter variables and user exits in your formula, you must enter single quotation marks ( ' ) around them. When creating a formula for a variable, you use the same syntax rules described in the above "Rules for Creating Formulas" section.

See also:

Creating Formula Variables