Wednesday, October 18, 2006

The %SKIP Macro

When working on a lengthy SAS program, there are a couple of ways to block out parts of your code so they don’t execute.

For example, you can use a forward slash and an asterisk:
/* SAS code to skip */

SAS has an automatic macro for blocking out lines of code, the SKIP macro. The advantage of this method is that it allows you to collapse the code while you’re working on other parts of the program:

- %macro skip;
SAS code to skip
%mend skip;

Macros are one example of collapsable code sections, which enable you to expand or collapse sections of code. An expanded section is indicated by a minus sign in the margin.

To collapse a section of code, click the minus sign. The results are:

+ %macro skip;

A collapsed section is indicated by a plus sign in the margin. To expand a section, click on the plus sign.


At 3:12 AM, Anonymous Anonymous said...

I've frequently used this trick. I always called it Macro DeadCode. Somehow, that seemed more appropriate.

--Andy Arnold


Post a Comment

<< Home