Understanding Session-Compiled Macros

In Creating and Using Macro Programs, you learned that you can submit a macro definition in order to compile a macro. For example, when you submit the macro definition shown here, the macro processor compiles the macro Prtlast:
%macro prtlast;
   %if &syslast ne _NULL_ %then %do;
      proc print data=&syslast(obs=5);
         title "Listing of &syslast data set";
      run;
   %end;
   %else
      %put No data set has been created yet.;
%mend;
By default, the Prtlast macro is stored in a temporary SAS catalog as Work.Sasmacr.Prtlast.Macro. Macros that are stored in this temporary SAS catalog are known as session-compiled macros. Once a macro has been compiled, it can be invoked from a SAS program as shown here:
proc sort data=sasuser.courses ...

Get SAS Certification Prep Guide, 4th Edition 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.