Previous Page | Next Page

Macro Facility under OpenVMS

Stored Compiled Macro Facility under OpenVMS


Introduction to the Stored Compiled Macro Facility

The stored compiled macro facility gives you access to permanent SAS catalogs that contain compiled macros. For SAS to use stored compiled macros, the SAS system option MSTORED must be in effect. In addition, you use the SAS system 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: Concepts.


Advantages of Using the Stored Compiled Macros

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]


Making Your Stored Compiled Macros Accessible to Your SAS Session

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 '[dir]';
options mstored sasmstore=mylib;

%macro myfiles / store;
   filename file1 '[dir]first.dat';
   filename file2 '[dir]second.dat';
%mend;

/*  Use a Stored Compiled Macro     */
/*     in a Later Session           */
libname mylib '[dir]';
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;


Controlling Memory Availability for Storing Macro Variables

Two system options control the maximum amount of memory available for storage of macro variables:

MVARSIZE=n

specifies the maximum number of bytes for any macro variable stored in memory (0 <= n <= 32768). The default setting for this option in the OpenVMS operating environment is 8192.

MSYMTABMAX=n

specifies the maximum amount of memory available to all symbol tables (global and local combined). The value of n can be expressed as an integer or MAX (the largest integer your operating environment can represent). The default setting for this option in the OpenVMS operating environment is 51200.

You can specify these system options in the following places:

Previous Page | Next Page | Top of Page