Modifies the position order of the variables for a
specified dataset by key and alphabetical order
%ordervar (data=dataset name,
filetype=file
type,
key1-key10=key variables);
Where | Is
Type... | And
represents... |
dataset name | C (200) | The name of the dataset to be
ordered including the libname. This uses the dot
notation such as libname.dataset. If only the
dataset name is given, the work area is implied. |
file type | C
(optional) | The file type determines the SAS dataset
format. There are two choices including:
- SAS data [default]
- Transport
|
key variables | C
(optional) | Assign specified variables to be keys.
The key variables will appear at the top before the
sorting is applied. | Details
This tool modifies the position attributes of all the
variables within a specified dataset. The sorting order is
by:
- Key fields and their associated order
- Alphabetical order by variable name
The newly updated dataset will have the same name containing
the same variables. The only change is in the position
attribute of each variable. If a wild card is specified with
an asterisk such as in: mylib.* All the dataset specified within that library will be ordered. The transport file will look for the file extension (.xpt).
This file extension is not needed in the data
parameter. Some of the error conditions that ordervar will check
for includes:
- The data parameter is
required.
- The library name and data specified exist.
- If specified, the file type can only be "SAS Data"
or "Transport". Casing is not significant.
- Key variables specified must exist in the specified
dataset(s).
Example libname inlib '/my/study/directory'; %ordervar(data=inlib.a_ae);
%ordervar(data=inlib.*,
key1=subjid);
%ordervar(data=inlib.a_demog,
filetype=transport,
key1=subjid); |