DIV macro

The DIV macro is available in Unica Campaign and Unica Interact.

Syntax

data DIV divisor data / divisor

Parameters

data

The numerical values to divide into. This can be a constant value, a column, a cell range, or an expression evaluating to any of the above. For the format definition of data, see the "Macro Function Parameters" section in the chapter in this guide for your product.

divisor

The value(s) to divide the values in the specified data range by. This can be a constant value, a column, a cell range, or an expression evaluating to any of the above. The number of columns in data2 must equal the number of columns in data1, unless data2 is a constant. For the format definition of divisor (same as data), see the "Macro Function Parameters" section in the chapter in this guide for your product.

Description

DIV divides the specified data range by the divisor value. It returns a new column for each input column, each containing the corresponding column in data1 divided by the corresponding column of data2 (that is, the first column of data1 is divided by to the first column of data, the second column with the second column, and so on).

If data2 is a constant, each value in data1 is divided by that value. If data2 contains one or more columns, the calculations are performed on a row-by-row basis between one column from data2 and one column from data2. The first row of data1 is divided by the first row value of data2, the second row with the second row, and so on. This row-by-row calculation produces a result for each row up to the last value of the shortest column.

Note: Using a column containing the same number x in each row as divisor is the same as using the constant x as divisor.
Note: The DIV operator can be abbreviated with a slash ( /).

Examples

TEMP = 8 DIV 4 or TEMP = 8/4

Creates a new column named TEMP containing the value two.

TEMP = V1/8

Creates a new column named TEMP, where each value is the contents of column V1 divided by eight.

TEMP =V1:V3/2

Creates three new columns named TEMP, VX, and VY. The values in the TEMP column are the contents of column V1 divided by two, the values of the VX column are the contents of column V2 divided by two, and the values of the VY column are the contents of column V3 divided by two.

TEMP = V1/V1

Creates a new column named TEMP containing all ones (since any number divided by itself is one).

TEMP = V1/V2

Creates a new column named TEMP, where each value is the row value of column V1 divided by the corresponding row value of column V2.

TEMP = V1:V3/V4:V6

Creates three new columns named TEMP, VX, and VY. The column TEMP contains the values in V1 divided by the corresponding row values of column V4. The column VX contains the division of column V2 by V5. The column VY contains the division of column V3 by V6.

TEMP = V1[10:20] / V2 or TEMP = V1[10:20] / V2[1:11]

Creates a new column named TEMP, where the first 11 cells contain the result of dividing the values in rows 10-20 of column V1 by the values in rows 1-11 of column V2. The other cells in TEMP are empty.

Related functions

Function Description
MOD Computes the modulo of the contents of the specified data range
MULT Multiplies the contents of two data ranges
POW Computes a base value raised to the specified exponential powers