This post was kindly contributed by The SAS Training Post - go there to comment and to read the full post. |
James Bond: “Give me the old fashioned target range, Quartermaster. “
Q: “Yes, well, it’s called the future, so get used to it.”
In James Bond movies, it’s Q’s job to disguise wickedly effective technology as seemingly innocuous everyday objects. The power of those seemingly everyday objects, revealed at just the right moment, enabled 007 to pull off amazing feats and defeat the evil-doers.
In SAS programming macro is our secret weapon, enabling similarly amazing feats. But frequently, keeping "special characters" concealed until just the right moment is the key to victory. As a SAS programmer, I’ve been involved in many an epic struggle to debug a macro program. And more than once, a macro variable containing special characters becoming "unquoted" too soon proved to be my downfall. It’s a delicate game, and is especially problematic when a macro uses values read from external files, the operating system, or when values were inserted into macro variables using DATA step CALL routines or PROC SQL’s SELECT INTO syntax. Macro’s “Q” functions can be our secret weapon, helping us keep those special characters under cover until we are ready to unveil their true power.
Continue reading “Jedi SAS Tricks: Macro Q functions”
This post was kindly contributed by The SAS Training Post - go there to comment and to read the full post. |