As SAS user Marje Fecht said "We all want a 'SAS programming assistant' to help us complete our jobs more quickly." Fecht, Senior Partner at Prowerk Consulting, then went on to say "In her book SAS Macro Programming Made Easy, Second Edition, Michele Burlew encourages us to take advantage of the SAS Macro Facility as our 'SAS programming assistant.'"
Michele Burlew is a favorite among SAS users (and reviewers). Besides being one of the most gracious people you'll ever meet, she's used her extensive SAS expertise to write many highly usable and instructive SAS books. Chances are that if you don't own one of Michele's books, you've noticed them at conferences or heard about her work. If you like this week's featured SAS tip, I'd encourage you to visit Michele's author page to learn about all of her books, as well as her upcoming title SAS Hash Objects: A Programmer's Guide.
The following excerpt is from SAS Press author Michele M. Burlew and her book "SAS Macro Programming Made Easy, Second Edition" Copyright © 2006, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED. (please note that results may vary depending on your version of SAS software)
Example 8.4: Using %NRSTR to Mask Macro Triggers
This example shows how to prevent the two macro triggers, ampersands and percent signs, from interpretation at compilation by masking the triggers with the %NRSTR function. The goal is to assign text that contains an ampersand and a percent sign to the macro variable, REPORTTITLE.
The previous examples in this section used the %STR function, which does not mask macro triggers. The %NRSTR function masks all that %STR does, and it also masks macro triggers.
Without masking the ampersand, the macro processor interprets the text following the ampersand as a macro variable that should be resolved. The text following the ampersand in this example is Feb. Assume when the statements execute in this example, the macro variable named Feb does not exist in the global symbol table.
Without masking the percent sign, the macro processor interprets the text following the percent sign as a macro program call that it should execute. The text following the percent sign in this example is Sales. Assume when the statements execute in this example, a macro program named SALES has not already been compiled.
Execution of the first %LET and first %PUT statements generate warnings, not errors. The macro processor does assign a value to REPORTTITLE. Every time it attempts to resolve REPORTTITLE, it also tries to resolve FEB as a macro variable and SALES as a macro program invocation.