O'Reilly logo

SAS Macro Language Magic by Robert Virgile

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10: Generating Text

10.1 Utilizing Generated Text

10.2 Counting Words in a String

10.3 Working with Lists

10.4 Prefer the Macro Solution

When macro language generates a word, the software figures out what to do with that word. The software might incorporate the word into a macro language statement, or it might embed the word as part of a SAS language statement. While that sounds simple, it leads to some interesting coding techniques.

10.1 Utilizing Generated Text

Here is some legitimate code that could appear within a macro definition:

data   %do quarter=1 %to 4;

                   q&quarter

          %end;

          ;

Each word, whether hard-coded or generated by macro language, gets incorporated into the SAS program, producing:

data q1 q2 q3 q4; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required