Previous Page | Next Page

Macros under z/OS

Stored Compiled Macro Facility


Overview of the Stored Compiled Macro Facility

The stored compiled macro facility gives you access to permanent SAS catalogs that contain compiled macros. In order for SAS to use stored compiled macros, the SAS option MSTORED must be in effect. In addition, you use the SAS option SASMSTORE= to specify the libref of a SAS library that contains a catalog of stored compiled SAS macros. For more information about these options, see SAS Language Reference: Dictionary.

Using stored compiled macros offers the following advantages over other methods of making macros available to your session:

Because you cannot re-create the source statements from a compiled macro, you must save the original macro source statements.

Note:   Catalogs of stored compiled macros cannot be concatenated.  [cautionend]

If you do not want to use the stored compiled macro facility, you can make macros accessible to your SAS session or job by doing the following:

Your most efficient choice might be to use the stored compiled macro facility.


Accessing Stored Compiled Macros

The following example illustrates how to create a stored compiled macro in one session and then use the macro in a later session.

/*  Create a Stored Compiled Macro      */
/*      in One Session                  */
libname mylib 'u.macro.mysecret' disp=old;
options mstored sasmstore=mylib;
%macro myfiles / store;
  filename file1 'mylib.first';
  filename file2 'mylib.second';
%mend;

/*  Use the Stored Compiled Macro       */
/*       in a Later Session             */
libname mylib 'u.macro.mysecret' disp=shr;
options mstored sasmstore=mylib;

%myfiles
data _null_;
   infile file1;
      *statements that read input file FILE1;
   file file2;
      *statements that write to output file FILE2;
run;


FOOTNOTE 1:   The %INCLUDE statement takes as arguments the same types of file specifications as the INCLUDE command. See INCLUDE Command: z/OS. [arrow]

Previous Page | Next Page | Top of Page