PING
0.9
Statistical data handling and processing in production environment
|
Sort the observations in a given dataset.
idsn
: a dataset reference;asc
: (option) list of variables to consider so as to sort idsn
in ascending order; default: not set;desc
: (option) list of variables to consider so as to sort idsn
in ascending order; default: not set; note however that asc
and desc
cannot be both empty;dupdsn
: (option) name of the DUPOUT
dataset, i.e. all deleted observations, if any, will be put in this dataset (in WORK
library); default: not used;sortseq
: (option) option used by the PROC SORT
procedure so as to change the sorting order of character variables; default: not used;options
: (option) any additional options accepted by the PROC SORT
procedure;ilib
: (option) name of the input library; by default: empty, i.e. WORK
is used;odsn
: (option) name of the output dataset (in WORK
library) sorted by (ascending) asc
variables and descending desc
variables; when not set, the input dataset idsn
will be replaced with the newly sorted version; default: not set;olib
: (option) name of the output library; by default: empty, and the value of ilib
is used.Let us consider the test dataset #35:
geo | time | EQ_INC20 | RB050a |
---|---|---|---|
BE | 2009 | 10 | 10 |
BE | 2010 | 50 | 10 |
BE | 2011 | 60 | 10 |
BE | 2012 | 20 | 20 |
BE | 2013 | 10 | 20 |
BE | 2014 | 30 | 20 |
BE | 2015 | 40 | 20 |
IT | 2009 | 10 | 10 |
IT | 2010 | 50 | 10 |
IT | 2011 | 50 | 10 |
IT | 2012 | 30 | 20 |
IT | 2013 | 30 | 20 |
IT | 2014 | 20 | 20 |
IT | 2015 | 50 | 20 |
and run the macro:
which updates _dstest35 with the following table:
geo | time | EQ_INC20 | RB050a |
---|---|---|---|
BE | 2009 | 10 | 10 |
IT | 2009 | 10 | 10 |
BE | 2010 | 50 | 10 |
IT | 2010 | 50 | 10 |
BE | 2011 | 60 | 10 |
IT | 2011 | 50 | 10 |
IT | 2012 | 30 | 20 |
BE | 2012 | 20 | 20 |
IT | 2013 | 30 | 20 |
BE | 2013 | 10 | 20 |
BE | 2014 | 30 | 20 |
IT | 2014 | 20 | 20 |
IT | 2015 | 50 | 20 |
BE | 2015 | 40 | 20 |
Run macro %_example_ds_sort
for more examples.
PROC SORT
procedure:G_PING_DEBUG=1
), the macro is used to return a string: where proc
is the procedure that launches the operation (see above), and while the actual operation is actually not ran. Further note that in the case the variable G_PING_DEBUG` is not defined in your environment, debug mode is ignored (i.e., by default the operation is ran).