NUMBER macro
The NUMBER macro is available in IBM® Campaign and IBM® Interact.
Syntax
NUMBER(data [, conversion_keyword])
Parameters
data
The ASCII text data to convert to numerical values. This can be ASCII text in quotes, a column of text, a cell range containing text, 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.
conversion_keyword
This optional keyword specifies how to interpret text formats for dates and times. Select one of the keywords in the following table.
*
Converts a 3-letter month abbreviation to a value between 1-12 (for example, "MAR" to 3) [Note this is the same as conversion keyword 8]
Converts a fully spelled-out month name to a value between 1-12 (for example, "March" to 3) [Note this is the same as conversion keyword 9]
Description
NUMBER converts text values in the specified data range into numerical values using the specified format for converting dates and times. If a text string cannot be parsed using the specified conversion_keyword, NUMBER will generate an error. Format 0 converts the first five characters of each text string into different number for each unique text string. This is an easy way to change a column of text into unique classes for outputs to a classifier.
The delimited formats (conversion keywords 43-49) support any of the following as delimiters:
*
*
*
*
*
Months can be represented as mm or mmm; days can be represented as d or dd; years can be represented as yy or yyyy.
*
In support of year 2000 compliance, all years in dates may be designated as yyyy instead of yy. For backwards compatibility, conversion keywords 1-16, yy (2-digit years) automatically have 1900 added. For conversion keywords 17-55, yy < threshold automatically have 2000 added; yy ≥ threshold automatically have 1900 added.
*
The year 2000 threshold value is set in the Data Cleaning tab of the Advanced Settings window (invoke using Options > Settings > Advanced Settings).
*
If you change the value year 2000 threshold value, you must update all macro functions using the NUMBER macro function to manipulate date values with 2-digit years. To force an update of a macro function, you can make any edit (for example, adding a space and deleting it) and clicking the check mark icon to accept the change.
*
Examples
TEMP = NUMBER("$1.23") or TEMP = NUMBER("123%", 2)
Creates a new column named TEMP containing the number 1.23.
Creates a new column named TEMP containing the numbers 1, 3, and 12.
Creates a new column named TEMP containing the number 832.
Creates a new column named TEMP containing the number 728660.
Creates a new column named TEMP containing the numeric values of the text strings in column V1. Any dollar values are correctly converted into numerical values. ??? 's returned for text strings that cannot be parsed using the $ format.
Creates three new columns named TEMP, VX, and VY. The column TEMP contains the numerical values of text strings in column V1. The column VX contains the numerical values of text strings in column V2. The column VY contains the numerical values of text strings in column V3. Any dates in the format dd-mmm-yy are converted into the number of days offset from January 1, 0000. ??? 's are returned for text strings that cannot be parsed using the $ format.
Creates two new columns named TEMP and VX. The column TEMP contains the numerical values of text strings in rows 10-20 of column V1. The column VX contains the numerical values of text strings in rows 10-20 column V2. All standard three character representations of days of the week are converted into the numbers 0-6 (0 = Sunday, 6= Saturday). If there is no match for a weekday name, ??? is returned.
Assuming that column V1 contains all 5-digit text strings, creates one new column named TEMP containing a different numerical value for each unique string.
Related functions