CONSTANT
Applies to PredictiveInsight only.
Syntax
CONSTANT(data)
Parameters
data
The values to copy as constants. 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 IBM® product.
Description
CONSTANT makes a static copy of the values in specified data range. These copied values do not change if the corresponding values in the input column(s) change. The data values are copied once at the time the macro function is applied. CONSTANT returns one new column for each input column, each containing a static copy of the values in the corresponding input column.
*
Applying the CONSTANT macro function can result in significant performance improvements in running experiments. If the input or output columns for an experiment are based on complex (slow) calculations in the spreadsheet, add the CONSTANT macro function to each of the columns. This will calculate the values once and store the calculated values. Otherwise, every time the experiment accesses the spreadsheet for pattern data, the values must be recomputed.
*
If the data values may change, use the BUFFER macro function instead. This creates a dynamic copy of the data range, where the copied values will change if the corresponding input values change.
*
If a user function is built from a function definition using the CONSTANT macro function, the portion of the function definition enclosed in the CONSTANT macro function is considered a constant. Any input variables will not be required to apply the user function.
Examples
Creates a new column named TEMP containing the value 4.3.
Creates a new column named TEMP, where each value is a static copy of the contents of column V1.
Creates three new columns named TEMP, VX, and VY. The values in the TEMP column are copies of the contents of column V1, the values of the VX column are copies of the contents of column V2, and the values of the VY column are copies of the contents of column V3.
Creates a new column named TEMP, where the first 11 cells contain copies of the values in rows 10-20 of column V1. The other cells in TEMP are empty.
Creates two new columns named TEMP and VX, each with values in rows 1-50 (the other cells are empty). The values in column TEMP are copies of the rows of column V1, and the values in column VX are copies of the values in column V2.
Creates three new columns named TEMP, VX, and VY. The three columns contain the valid rows (that is, rows which do not contain any ??? cells) of columns V1 - V3. Wrapping the EXTRACT macro function inside CONSTANT prevents columns TEMP, VX, and VY from being recomputed if columns V1 - V3 change, thereby avoiding the computationally intensive EXTRACT macro function.
Related Functions