POWER macro

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

Syntax

base POWER exponent base ^ exponent

Parameters

base

The numerical values to raise to an exponential power. 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 base (same as data), see the "Macro Function Parameters" section in the chapter in this guide for your product.

exponent

The exponential number(s) to raise the values in data 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 exponent must equal the number of columns in base, unless base is a constant. For the format definition of exponent (same as data), see the "Macro Function Parameters" section in the chapter in this guide for your product.

Description

POWER raises the values in the first data range to the power specified in the second data range (that is, calculates ). It returns one new column for each input column, each containing the result of raising the base to the exponent power (that is, the first column of data1 is raised to the first column of data, the second column with the second column, and so on).

If exponent is a constant, each value in base is raised by that value. If exponent contains one or more columns, the calculations are performed on a row-by-row basis between one column from base and one column from exponent. The first row of base is raised to the first row value of exponent, 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: The POWER operator can be abbreviated with a circumflex (^). For example, TEMP = 2^8 is equivalent to TEMP = 2 POWER 8.
Note: If the value x is too large or too small, an overflow is returned. This occurs if base^exponent exceeds the maximum or minimum 32-bit floating-point value.

Examples

TEMP = 2 POWER 3 or TEMP = 2^3

Creates a new column named TEMP containing the value eight.

TEMP = V1 ^ 0.5

Creates a new column named TEMP, where each value is the square root of the contents of column V1 (this is equivalent to SQRT(V1)).

TEMP = V1 ^ V3

Creates a new column named TEMP, where each value is the row value of column V1 raised to 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 raised to the corresponding row values of column V4. The column VX contains the result of column V2 raised to the corresponding values in column V5. The column VY contains the the result of column V3 raised to the corresponding values of V6.

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

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

Related functions

Function Description
EXP Computes the natural number (e) raised to the contents of each cell in the specified data range
LN or LOG Computes the natural log of the contents of the specified data range
LN2 Computes the log base2 of the contents of the specified data range
LN10 Computes the log base10 of the contents of the specified data range