PING
0.9
Statistical data handling and processing in production environment
|
Retrieve the list (possibly ordered by varnum) of variables/fields in a given dataset.
dsn
: a dataset reference;varnum
: (option) boolean flag (yes/no
) set to order the output list of variables by varnum, i.e. their actual position in the table; default: varnum=yes
and the variables returned in _varlst_
(see below) are ordered;lib
: (option) name of the input library; by default: empty, i.e. WORK
is used._varlst_
: name of the output macro variable where the list of variables/fields of the dataset dsn
are stored;_typlst_
: (option) name of the output macro variable storing the corresponding list of variables/fields types; the output list shall be of the same length as &_varlst_
; encoding: 1 for numeric variable, 2 for char variable; default: it will not be returned;_lenlst_
: (option) ibid with the variable lengths; default: it will not be returned.Consider the test dataset #5:
f | e | d | c | b | a |
---|---|---|---|---|---|
. | 1 | 2 | 3 | . | 5 |
One can retrieve the ordered list of variables in the dataset with the command:
which returns list=f e d c b a
, while:
returns list=a b c d e f
. Similarly, we can also run it on our database, e.g.:
returns:
list=geo time age sex unit ivalue iflag unrel n ntot totwgh lastup lastuser
,typs= 2 1 2 2 2 1 2 1 1 1 1 2 2
,lens= 5 8 13 3 13 8 1 8 8 8 8 7 7
.Another useful use: we can retrieve data of interest from existing tables, e.g. the list of geographical zones in the EU:
which will return: zones=EA EA12 EA13 EA16 EA17 EA18 EA19 EEA EEA18 EEA28 EEA30 EU15 EU25 EU27 EU28 EFTA EU07 EU09 EU10 EU12
.
Run macro %_example_ds_contents
for more examples.
In short, the program runs (when varnum=yes
):
and retrieves the resulting name
, type
and length
variables.