Macro
Tips relating to SAS Macros, including how to create them, when to use them, and sample macros illustrating their use.
We send out a regular newsletter communication to our customers which include our latest SAS tips. Sign up to the Amadeus Newsletter.
-
Outputting Macro Generated Code to a File Using MPRINT
- Date:
- May 2012
A useful technique when debugging complicated macros, is to route all macro generated code to a file by using the MPRINT and MFILE options.
-
Resolve to Gain Total Control of Macro References
- Date:
- April 2012
The RESOLVE function, like SYMGET, is a data step function used to resolve macro variable references. In addition, the RESOLVE function can resolve macros and data step variab...
-
How to Pass a Varying List of Parameters to a Macro
- Date:
- March 2012
All we are doing in the here is calling the Macro with a varying list of parameters and then looping through that list
-
Deleting Macro Variables
- Date:
- August 2011
Each SAS session has a finite amount of memory allocated to for macro variables
-
Viewing the Values of All Current Macro Variables
- Date:
- July 2011
When developing or debugging a SAS application, it is often useful to check the values that have been assigned to Macro variables.
-
Stored Macros – Where’s the Source?
- Date:
- April 2011
Under V9 you can specify that the source code is saved with the compiled macro.
-
Conditionals in Macros
- Date:
- March 2010
How to avoid common mistakes when using conditionals in macros.
-
Macro Loops by Month
- Date:
- March 2010
A macro which will loop between two input dates, a month at a time
-
Using the IN Operator with the Macro Language in SAS 9.2
- Date:
- March 2010
In data step code it is common practice to use an IN operator in place of lots of OR statements, this allows you to write code that is concise and less repetitive. In SAS 9.2 ...
-
How to Keep Secret Code Secret
- Date:
- August 2010
Often when using the macro language we tend to compile a macro and then run it in the same SAS session. This tip shows how you can store the compiled macro, and secure it so t...


