![]() |
PING
0.9
Statistical data handling and processing in production environment
|
Create a dataset by applying filtering conditions (when it exists), and/or stacking it with annother dataset (one-to-one or one-to-many merge).
ref : a master/reference dataset; may exist or not;rlib : (option) name of the library where the master dataset ref is stored; by default: empty, i.e. WORK is used; however, if ref does not exist and dsn is given, then it is set to lib (see below), otherwise it is set to the default value;dsn : (option) a secondary datasets to stack/merge with the reference dataset;lib : (option) name of the library where the dataset dsn is stored; by default: empty and WORK is used;by : (option) list of variables to use for (smart) sorted output stack; both datasets ref and dsn need to be sorted by the same variables beforehand;cond : (option) condition to apply to dsn data set;if : (option) condition to apply to dsn input data sets.Updates or creates the master dataset ref.
Let us consider both tables _dstest30 and _dstest31, as respectively: The following table is stored in _dstest30:
| geo | value |
|---|---|
| BE | 0 |
| AT | 0.1 |
| BG | 0.2 |
| '' | 0.3 |
| FR | 0.4 |
| IT | 0.5 |
The following table is stored in _dstest31:
| geo | value | unit |
|---|---|---|
| BE | 0 | EUR |
| AT | 0.1 | EUR |
| BG | 0.2 | NAC |
| LU | 0.3 | EUR |
| FR | 0.4 | NAC |
| IT | 0.5 | EUR |
then we can "merge" _dstest30 into _dstest31 by invoking the macro as follows:
so that we get the output table:
| geo | value | unit |
|---|---|---|
| AT | 0.1 | EUR |
| BE | 0 | EUR |
| BG | 0.2 | NAC |
| FR | 0.4 | NAC |
| IT | 0.5 | EUR |
since the condition cond applies on the table ds_input_vi.
Run macro %_example_ds_merge for more examples.
The macro %ds_merge processes several occurrences of the data setp merge, e.g. in short it runs something like: