This post was kindly contributed by Key Happenings at support.sas.com - go there to comment and to read the full post. |
On the final day of SESUG 2010, I only had time to attend one presentation. I chose Frank DiIorio’s %whatChanged: A Tool for the Well-Behaved Macro for two reasons: 1.) Papers about macros are big hits with SAS Tech Report readers and 2.) DiIorio is a longtime SAS user with nearly three decades of SAS experience. The combo was a win-win.
DiIorio opened his presentation by saying that macros can be a force for good or for chaos. “If you turn your programs over to someone who is undisciplined, chaos can emerge from poorly constructed macros,” he said.
His alternative was to provide a macro that will allow programmers to see the effects of their macros. He also gave some best practices for good macro design. DiIorio created %whatChanged because clients and users want your macros to do what YOU say they will do. They shouldn’t be saddled with unintentional macros, data sets or tables. With his macro, you can view a snap shot of your data before and after running your macro. I couldn’t put everything DiIorio said into a small blog post, so I captured his list of good macro design best practices.
Keys to Good Macro Design
- Know when a macro is and is not necessary.
- Use keyword parameters and values consistently.
- Use consistent program structure.
- Know when to redesign. (If you have the luxury of time.)
- Communicate with the user and with other programs.
- Control macro variable scope.
- Implement diagnostic and debugging code.
- Use built-in macro tools.
- Clearly document the macro.
- Produce only what was promised!
SESUG 2010 was a great success and planning is well underway for SESUG 2011. Chairs for SESUG 2011 are Marje Fecht and Barbara Okerson. Subscribe to the SESUG mailing list and follow Stephanie Thompson (@SRT_SESUG) on Twitter to stay up-to-date on 2011 registration and presentaton information.
This post was kindly contributed by Key Happenings at support.sas.com - go there to comment and to read the full post. |