BookmarkSubscribeRSS Feed

More Muggles, More Macros: Adding Advanced Data-Driven Wizardry to Your SAS Programs

Started a week ago by
Modified a week ago by
Views 522
In their popular 2024 presentation, From Muggles to Macros, Horstman and Watson delivered a spell book full of macro magic to enhance SAS programs with data-driven wizardry. This exciting sequel to that enchanting performance adds to the list of incantations for creating dynamic, flexible, reusable programs that automatically adapt to change. New charms include using control tables, the CALL EXECUTE routine and more macro language techniques. Don't hard-code data values into your programs. Cast a vanishing spell on data dependencies and let the macro facility write your SAS code for you!
 
Presenting Companies: DataRich Consulting and Nested Loop Consulting

Watch the recording

Comments

Great information presented by experienced and knowledgeable SAS users. 

That's the content type people want to see at events like SAS Innovate!

The Muggles to Macros presentations provide valuable content to the core of the SAS community: SAS users. Well-explained IRL examples and amusing tie-ins to Harry Potter makes this content a must-see! Great job by the presenters.

Tom

Nice presentation.  Certainly an effort worthy of an OWL.  But nagging issues show they might need a little more study before taking their NEWT exams.

 

Main concern is this over dependency on generating so many macro variables.  They might be accidentally stumbling into a  Gemino Curse.  This is especially disappointing as the later half of the presentation is all about how you can generate code directly from data, which will eliminate the need for spamming your symbol tables with the wallpaper code of macro variable "lists".

 

They also seem to have fallen into the trap of using MAGIC macro variables in their macro definitions.  Those are macro variables referenced in the middle of a macro that are not parameters or local macro variables or even mentioned in the comments.  Instead the macro variables are apparently expected to have received their values by magic.  But perhaps we should cut them a little slack as the missing %LOCAL statements might have been removed to fit the code onto the slides.

 

And the example log at around the 31:27 time mark is not from the data step shown on the previous slide.  It is showing the code generated by the macro call as the code pushed into the stack to execute Instead of showing the macro call itself.   Thus they failed to demonstrate a major benefit of using the %NRSTR() macro function with CALL EXECUTE(); The resulting SAS log is much easier to read!

 

And they could have picked a better example for the macro expression to demonstrate the RESOLVE() function.  The example of using a dataset variable's value to perform one of their beloved macro variable "list" references is better suited to the SYMGETN() function:  DEMO = symgetn(cats("N",TRT01PN));   But perhaps they did that on purpose to talk about the need for using single quotes to suppress macro triggers.  Or just to setup the nice reference to the SYMGET() and SYMGETN() functions in the Q&A session.

Version history
Last update:
a week ago
Updated by:
Contributors

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Article Tags