![]() |
PING
0.9
Statistical data handling and processing in production environment
|
Perform a 'bulk-renaming' of the variables of a given table.
idsn : input reference dataset, whose variables shall be renamed;var : (option) list of variables that should be renamed; this parameter is incompatible with the parameter ex_var below; default: var is empty, and all variables present in the input dataset idsn will be renamed (unless ex_var is not empty);ex_var : (option) list of variables that should not be renamed; this parameter is incompatible with the parameter var below;typically the identifying variables which will be used to perform the matching shall not be renamed; default: ex_var is empty;suff : (option) generic suffix to be added to the names of the variables; default: suff=_new, i.e. a variable a in idsn will be renamed as a_new;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 exact same data than idsn, where all variables defined by var and/or excluding those defined by ex_var are renamed as a concatenation of their former name and suff; 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 | d2 | c2 | b | a2 |
|---|---|---|---|---|---|
| . | 1 | 2 | 3 | . | 5 |
Run macro %_example_var_rename for more examples.
var_rename can be used for this purpose.var and ex_var is passed, all variables present in the input dataset idsn are renamed.