As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Tips:Multiple Dataset Options

From sasCommunity
Jump to: navigation, search

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 lexicographical(alphabetical) order of their names. That is, a drop option is executed before a keep, and a keep before a rename. A logical consequence is that you have to use the old (before being renamed) variable names in your keep and drop options. Another is that you cannot keep a variable, if dropped.

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? The answer can be found in the discussion page.

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

Submitted by Chang Y. Chung. Contact me at my Discussion Page.

Using Dataset Options (9.2)