Like the SAS® Macro Programming blog example below? Want to have immediate access to all of these SAS® papers and other powerful SAS® papers to improve your productivity, then become a SAS Savvy member now.
As SAS® programmers advance in their career, there is at least a 80% chance that you will encounter SAS® macros to help automate and standardize processes. From SAS® macro essentials to advanced SAS® macro quoting functions, I am confident you will find these SAS® papers as useful as they have been for me. For a quick summary of SAS® macro benefits, access the Automating Tasks using SAS® Macro Programming e-Guide. See also Proc SQL, SAS Dictionary Tables and System Options.
Automating Tasks using SAS Macro Programming e-Guide
Automating Tasks using SAS Macro Programming e-Guide I
Automating Tasks using SAS Macro Programming e-Guide II
Automating Tasks using SAS Macro Programming e-Guide III
(Click on image below to start SAS® Macro Programming mind map)
Tips for SAS® Macro Programming Testing
1. Account for all assumptions and requirements.
2. Develop test cases based on macro logic. May require reviewing source macro program.
3. Apply specific test cases including:
- Good/Bad data sets
- Required/Optional parameters
- Valid/Invalid variable type and value
- Possible combination of macro parameters
- Duplicate records and empty subsets
4. Take advantages of system options:
MFILE saves the resolved macro variables to a separate file. MPRINT displays nested macro calls with indents.
5. Add _debug parameter for debugging purpose.
Macro Debugging 1 The Macro Degubbing Primer, Frank DiIorio
Macro Debugging 2 Demystifying the SAS Macro Facility, Marje Fecht, Harry Droogendyk
Macro Testing Discussions Welcome to Dullsville!! The System Testing of SAS Macros, James McGiffen
Macro Testing Methods SAS macro validation criteria, Jim Groeneveld
UnToken Paper with MFILE option A Macro to Unravel Macros, Sarah Woodruff, Have it Both Ways: Macros that Produce Publication-Quality Tables and Stand-alone Code, Linda Collins, Lisa Brooks, Michael Rea, Alan Hopkins
Macro Downloads:
1. General Utility Macros Macros to get to “Know Thy Data”, Diane Foose, Mike Gunshenan, Rick Morales
2. Compare Two Datasets Macro
3. Dataset Codebook Macro
4. Scan Log LOGCHK Macro
Top SAS® Macro Programming Papers
1. Nine Steps to Get Started using SAS Macros, Jane Stroupe
2.SAS® Macro Programming for Beginners, Susan Slaughter, Lora Delwiche
3. Get A Grip on Macros in just 50 Minutes!, Arthur Li
4. SAS® Macro: Symbols of Frustration? %Let us help! A Guide to Debugging Macros
Kevin Delaney, Art Carpenter
5. Using Macros to Automate SAS® Processing, Kari Richardson, Eric Rossland
6. A Macro to Unravel Macros, Sarah Woodruff
7. Storing and Using a List of Values in a Macro Variable, Arthur L. Carpenter
8. Five Ways to Create Macro Variables: A Short Introduction to the Macro Language, Arthur L. Carpenter
9. SAS Macros: Beyond the Basics, Jay A. Jaffe
10. Using Macro Functions, Art Carpenter
11. Macro Functions: How to Make Them - How to Use Them, Art Carpenter
12. Consistent Variables + Consistent Checks = Cleaner Data, Greg Silva
13. Advanced Macro Topics, Steven First
14.Macros to get to “Know Thy Data”, Diane Foose, Mike Gunshenan, Rick Morales
15. The Path, The Whole Path, And Nothing But the Path, So Help Me Windows,
Art Carpenter
16. A SAS autos Companion: Reusing Macros, Ronald Fehd
17. A Serious Look Macro Quoting, Ian Whitlock
18. Macro Quoting Functions, Other Special Character Masking Tools, and How To
Use Them, Art Carpenter
19. Tight Looping With Macro Arrays, Ted Clay
20. How to Develop User-Friendly Macros, Sy Truong
21. Programming Squared (Writing Programs that Write Programs),
Jim Johnson
22. Considerations for Building an Integrated Safety Database Using SAS,
Denise Smith, Daniel Schulz, Gayle Kloss, Wei Cheng
23. Advanced Macro Topics: Utilities and Examples, Art Carpenter
24. Developing a SAS System Autocall Macro Library as an Effective Toolkit, Steven A. Wilson
25. Creating Display Manager Abbreviations and Keyboard Macros for the Enhanced Editor, Art Carpenter
26. The SAS Training Post - Macro Q Functions
27. .LST Files with Proc Compare Result, Manvitha Yennam, Srinivas Vanam, Phaneendhar Vanam