REPEAT
Applies to PredictiveInsight only.
Syntax
REPEAT(num_times, data [, keyword])
Parameters
num_times
The number of times to repeat the specified data range. This can be a constant, a column, or an expression evaluating to any of the above. All values must be positive integers.
data
The numerical values to repeat. 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.
keyword
This optional keyword determines how the specified data range is replicated. Select one of the following:
ROW - Repeats rows of data vertically (default)
COL - Repeats columns of data horizontally
For more details on using keywords in IBM® Campaign, see Format Specifications.
For more details on using keywords in IBM® PredictiveInsight, see Format Specifications.
Description
REPEAT repeats the specified data range a number of times, either vertically (COL) or horizontally (ROW).
With the COL keyword, it returns one new column for each input column containing num_times copies of data, vertically concatenated. If the input columns of data have different lengths, the shorter columns are automatically padded. Numeric columns are padded with zero and text string columns are padded with empty strings ("").
With the ROW keyword, the number of columns returned depends on whether num_times is a constant or a column. If num_times is a constant, it returns num_times times the number of columns in data. If num_times is a column, it returns the specified number of copies of each column of data, where the first row value of num_times is the number of times to repeat the first column of data; the second row value is the number of times to repeat the second of column of data, etc. Any rows greater than the number of columns in data ignored.
Examples
TEMP = REPEAT(10, 1) or TEMP = REPEAT(10, 1, ROW)
Creates a new column named TEMP containing ten 1 's.
Creates a new column named TEMP containing two copies of the column V1 concatenated vertically.
Creates three new columns named TEMP, VX, and VY. TEMP contains three copies of column V1, VX contains three copies of column V2, and VY contains three copies of column V3. Any uneven length columns are padded to the length of the longest column of V1 - V3.
Creates two new columns named TEMP and VX. The values in column TEMP are 10 copies of rows 10-50 of column V1, and the values in column VX are 10 copies of rows 10-50 of column V2.
Creates one new column named TEMP, containing the cell values 10, 20, 20, 30, 30, 30.
Creates one new column named TEMP. The value in cell V2[1] is repeated V1[1] times, the value in cell V2[2] is repeated V1[2] times, and so on until the end of column V1.
Creates two new columns named TEMP and VX. The TEMP column contains copies of cells in V2; the VX column contains copies of cells in V3. There are V1[1] copies of V2[1] and V3[1], V1[2] copies of V2[2] and V3[2]. This continues until the end of column V1 or the end of the longest column in data, which ever is shorter. Shorter columns in data are padded with zeros.
Creates three new columns named TEMP, VX, and VY, each a copy of column V1.
Creates four new columns named TEMP, VX, VY, and VZ. Column TEMP is a copy of column V1; column VX is a copy of column V2, column VY is a copy of column V1; and column VZ is a copy of column V2.