Variable names

<< Click to Display Table of Contents >>

Navigation:  User guide > Variables >

Variable names

Variable names are always preceded by a dollar sign ("$"). Subject to the following rules, you may choose whatever names you like for variables.

Cols have names consisting entirely of numeric characters (0-9). The name makes up a number which describes the data location of the col. Unless CARD CHARACTERS is used, cols 81-100, 181-200 etc. may not be referred to.

Fields have names consisting of two data locations separated by the minus sign (-). The two locations mark the boundaries of the field. Unless CARD CHARACTERS is used, the boundary may not extend over a card boundary, e.g. $175-203 is not allowed.

Spreadfields have names consisting of two data locations separated by the minus sign (-) followed by an asterisk (*) and a repeat count. The two locations mark the boundaries of the first part of the spreadfield. The repeats follow immediately after the first part. Unless CARD CHARACTERS is used, the boundary may not extend over a card boundary, for example $174-175*4 is not allowed because the last part is in $180-181.

Colbins have names consisting of a data location followed by the suffix BIN for example, $106bin. The suffix denotes that the data location is to be thought of as containing an integer number in binary format.

Svar, mvar, ivar, wvar and cvar names begin with a letter (A-Z) and consist entirely of alpha and numeric characters or underscore; they may be up to thirty characters long, not including the $ prefix.

Exceptionally, these names may contain certain non-alphanumeric characters, provided that the name is enclosed in quotes ('). The quote characters do not count towards the limit of thirty characters in the name and should not include the preceding dollar character which should appear outside the quotes, for example, $'Q1.1'. Wholly numeric names in quotes are not the same as cols - for example, $'101' is treated as a variable and not data location 101.

Names beginning with the letter X (regardless of quotes) denote temporary variables unless RCP XNOTTEMP is used. In a Data Stage, this means a variable whose value will not be written to the IDF (and thus not available at a later Tables Stage). At other stages it has no significance. The letter X is part of the name and does count towards the limit of thirty characters in a name.

Any names may be chosen for svars, mvars, ivars, wvars and cvars, except those in a reserved list of names, see section Reserved variable names .

Each variable defined must have a unique name, but the same variable can be defined more than once, simply by using the same name again. If the same variable is defined twice the second definition replaces the contents of the variable with the second definition.

A cross reference list of all variables in each stage, and where they are mentioned in the CL script, can be produced by using run control parameter XREF.

Example variable names:

$143

$2106-2109

$120-120*8

$05bin

$age

$purch12a

$xtemp

$'1.a'

$'x3-f'