Chapter 10: Generating Text
10.2 Counting Words in a String
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; ...
Get SAS Macro Language Magic now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.