10-04-2016 02:01 PM
How can I put variables in the positions I require using SAS code?
when I use a merge, variables are positioned by default
In the dataset I can move columns / variables and change them posicision, but how to do it directly by code?
10-05-2016 02:16 AM
An "empty" format statement also works (only variable names, but no formats). Consider this if you want to prevent the main effect that retain has on variables that are not supplied by the contributing datasets.
10-05-2016 03:53 AM
@KurtBremser you are right, I have tested it without and with a given format after the variables list
and it worked fine in both cases.
It worked only if the format statement was before the set:
format x1-x5 3. ;
10-05-2016 04:20 AM
I used the term "empty" format statement as that does not override the attributes of variables coming from datasets, if those need to be preserved.
And yes, any "variable-ordering" statement has to come first in the data step. Doing it after the set (eg) means that the original order in the contributing datasets will take precedence. It's just how the data step compiler creates the PDV while scanning the data step code.
Need further help from the community? Please ask a new question.