Chapter 2: Shifting Gears: Macro Language
As the focus shifts from the SAS language to the macro language, similar principles apply. It pays to expand your knowledge, to experiment, and to keep up with the latest software features, all the while attempting to keep programs as simple as possible. For example, just as the SCAN function can read a list from right to left, the %SCAN function can as well. Revisit this macro parameter from the beginning of Chapter 1:
by_varlist = state county town,
Based on that parameter, a macro must generate this code (with the bold sections based on &BY_VARLIST):
proc sort data=municipalities;
by state county town;
run;
data last_one;
set municipalities;
by state county town;
if last.town;
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.