A SAS macro is a collection of statements used to perform one or more tasks.
By defining a macro, you can run these tasks very easily, simply by running a single macro statement.


For example, suppose you want to run an ANOVA on 15 dependent variables. You can either type in ~20 SAS statements and repeat this for each dependent variable. Or you can type %MMAOV(one,Y1,CLASS=TREAT,FIXED=TREAT); and repeat that for Y2, Y3 ... up to Y15. MAcros save you the time and effort of keeping track of a huge SAS program.

If someone gives you a SAS macro, that is even better; you do not have to do any programming at all. DAWG provides several macros inside the file. Explanations for how to use the macros are given in the DAWG modules.

For those of you that are interested, creating a SAS macro is fairly simple. First, create the statements that perform the task(s) in the SAS Editor Window. In front of the statements, put %MACRO yourname (define macro variables); . At the end of your statements, put %MEND; . Save as

To use this macro, type the following in the SAS Editor Window:

%yourname (MACROVAR1, MACROVAR2, ... );

This reads the SAS statements in and then runs the defined macro using MACROVAR1, MACROVAR2 ...