# EQ

The EQ command specifies a new expression for an already defined formula. In order to use EQ to assign an expression to a formula definition, the definition must be the one most recently defined or considered during the current session. When it is not, you must first use a CONSIDER command to make it the current definition.

An alternative to the EQ command is the EDIT FORMULA command, which is available only in OLAP Worksheet. The EDIT FORMULA command opens an Edit window in which you can add, delete, or change the expression to be calculated for a formula.

Be sure to distinguish between the EQ command described here and the EQ operator used to compare values of the same type.

Syntax

EQ [expression]

Arguments

expression

The calculation that will be performed to produce values when you use the formula. When you do not specify an expression, the EQ command sets the expression to `NA`. The formula text is not converted to uppercase.

Notes

Data Type and Dimensions

The data type and dimensions of the new expression should match the specified data type and dimensions in the definition of the formula. When they do not, the resulting values are converted to the formula's data type and the results are forced into the formula's dimensionality. The DESCRIBE command shows the formula's data type and dimensions. You can find out the data type and dimensions of the new expression by parsing it. See Example 9-114, "Using PARSE with EQ".

You cannot use the EQ command to change the data type or dimensions of a formula. To make changes in these, you must delete the formula and redefine it.

Examples

This example specifies a new expression for the `f1` formula with the following definition.

```DEFINE f1 FORMULA INTEGER <month line division>
EQ actual * 2
```

The statements

```CONSIDER f1
EQ actual * 3
DESCRIBE f1
```

produce the following definition of the formula with a new EQ.

```DEFINE F1 FORMULA INTEGER <MONTH LINE DIVISION>
EQ actual * 3
```

Example 9-114 Using PARSE with EQ

The following example supposes that your workspace already has a formula named `line.totals`. The PARSE and SHOW INFO statements check the dimensionality and data type of an expression. The CONSIDER and EQ statements assign the expression to the `line.totals` formula. The `line.totals` formulas has the following definition.

```DEFINE line.totals FORMULA DECIMAL <year line>
```

The statements

```PARSE 'total(actual line year)'
SHOW INFO(PARSE DIMENSION)
```

produce the following output.

```YEAR
LINE
```

The statement

```SHOW INFO(PARSE DATA)
```

produces the following output.

```DECIMAL
```

The output from INFO(PARSE) shows that the expression has the same dimensionality and data type as the `line.totals` formula. The statements

```CONSIDER line.totals
EQ TOTAL(actual line year)
DESCRIBE line.totals
```

show the definition of `line.totals` with its new EQ.

```DEFINE LINE.TOTALS FORMULA DECIMAL <YEAR LINE>
EQ total(actual line year)
```