PING
0.9
Statistical data handling and processing in production environment
|
Add variable(s) to a dataset and initialize it/them to some value(s).
idsn
: input reference dataset, where variables shall be inserted;var
: (option) list of variables that should be inserted;val
: (option) list of values that should be used to inizialize the inserted variables; the number of arguments passed in var
and val
MUST be the same;force_set
: (option) boolean flag (yes/no
) set to force the initialisation of the variable passed in var
:
yes
: the variable in var
is/are initialised whether it/they already exist/s in the dataset or not,no
: the variable in var
is/are initialised only when it is added to the dataset;default: force_set=no
is used;
ilib
: (option) name of the input library; by default: empty, i.e. WORK
is used.odsn
: (option) name of the output dataset (stored in the olib
library), that will contain the data from idsn
, plus the new variables inserted; default: odsn=idsn
and the input dataset idsn
is updated instead;olib
: (option) name of the output library; by default: empty, and the value of ilib
is used.Let us consider test dataset #5 in WORKing directory:
f | e | d | c | b | a |
---|---|---|---|---|---|
. | 1 | 2 | 3 | . | 5 |
then both calls to the macro below:
will return the exact same dataset out1=out2
(in WORKing directory) below:
f | e | d | c | b | a | FFF | AA |
---|---|---|---|---|---|---|---|
. | 1 | 2 | 3 | . | 5 | 10 | 20 |
Instead, the following instruction:
will return the exact same dataset out1=out2
(in WORKing directory) below:
f | e | d | c | b | a | k |
---|---|---|---|---|---|---|
. | 1 | 2 | 3 | . | 20 | 10 |
Run macro %_example_var_set
for more examples.
When force_set=yes
, the value of existing variable/s may be replaced this way.