PING
0.9
Statistical data handling and processing in production environment
|
dsn
: an input reference dataset;var
: either a (list of) variable name(s), or the (list of) position(s) of variable(s) whose existence in input dataset dsn
is tested; when var
is passed as a list of integers, it is only verified that these values are in the range [1,#{variables in dsn}]
where #{variables in dsn}
is the number of dimensions in dsn
; the list of variables of corresponding variables is then returned through _varlst_
(see below);lib
: (option) output library; default (not passed or ' '): lib
is set to WORK
.ans
: (option) the error code of the test, i.e.:
0
when the variable var
exists in the dataset,1
(error: "var does not exist") otherwise;should not be used contemporaneously with the option _varlst_
below; this is further unusable when var
is passed as a list of integers;
_varlst_
: (option) name of the macro variable used to store the string elements from var
that do actually define existing variables/fields in dsn
; incompatible with returned result ans
above.Let us consider the table _dstest5
:
f | e | d | c | b | a |
---|---|---|---|---|---|
. | 1 | 2 | 3 | . | 5 |
then:
returns ans=0 0 1 1 0
, the outputs of the existence test of string elements of var
in _dstest5
, while:
returns list=a b c
, the only string elements of var
which define variables in _dstest5
. Finally, it is possible to pass integer var
to the macro so as to retrieve the names of the variables in corresponding positions, e.g.:
returns list=EQ_INC20 geo RB050a time
.
Run macro %_example_var_check
for more examples.
ans
to the test when a result shall be returned (and _varlst_
is not passed), or an updated list of acceptable variables (when _varlst_
is passed). The former case is useful when testing a single variable existence in a dataset, the latter for triming a list of actual variables. Contemporaneous use is impossible.var
with the list of variables in dsn
, i.e. when _varlst_
is set:var
otherwise, i.e. when a single variable var
is passed:&_varlst_
/answer ans
matches that in the input list var
.var
matches a variable in dsn
, an empty list &_varlst_
/ answer ans
is set.%ds_check, %lib_check, %ds_contents, %dir_check, %file_check, VARNUM.