Pages

Thursday, October 10, 2013

Widgets

Order of execution in multiple dataset options?

When multiple dataset options are applied to a single statement, then the order of execution matters. The rule of thumb is that they are executed according to the alphabetical order of their names. That is, a drop option is executed before a keep, and a keep before a rename.
Now, given also that the variable number is decided by the order of first-appearance in the data step, can you guess the output of the code snippet below? 

data one;
  set sashelp.class(rename=(name=eman) keep=age sex name drop=age);
run;
 
/* check */
proc contents data=one varnum;
run;

No comments:

Post a Comment