numeric variable1ʃ, variable2, ..., variableNʅ;
The
numeric statement declares temporary numeric variables used in applications. They will not be saved to a data file defined by a dictionary. A numeric variable is an integer or decimal number significant to 15 digits. Upon declaration a numeric variable's initial value will be 0.
Local variables, with a limited scope, can also be declared in functions and
PROCs. The variable will only exist and be accessible from within the function or PROC where it is declared. (In the case of a PROC, it is available in all events within that PROC after its declaration. For example, a numeric declared in the preproc will still be accessible in the postproc.)
While a locally-declared variable cannot have the same name as a globally-declared variable, the same local variable name can be reused in other PROCS associated with individual variables.
The following variable modifiers apply to numeric variables:
- config: to initialize the variable from configuration settings.
- ensure: to create a variable only when it has not already been declared in a dictionary or logic.
- persistent: to persist the variable's value from one run of an application to another.
PROC GLOBAL
numeric NumOfKids, NumOfMoms;
PROC CHILDREN
numeric x;
NumOfKids = NumOfKids + 1;
x = NumOfKids + NumOfAdults;
PROC BIOLOGICAL_MOTHER
numeric x; // redeclaring a variable named "x", which is okay
NumOfMoms = NumOfMoms + 1;
x = NumOfMoms + NumOfDads;