Search notes:

SAS: compiling macros

%let workDir = /home/rene;

libname libMacro "&workDir/macros";

options
  mstored
  sasmstore=libMacro;


/* Create a Compiled macro. It will be stored in
   &workDir/macros/sasmacr.sas7bcat                            */ 
%macro tq84_CompiledMacro / 
   des      = "Macro description"
   store    /* Store compiled macro in library identified by 
               SASMSTORE option.
               Requires MSTORED option to be set.               */
   source   /* Also store source code along with compiled code  */
;

 %put -------------------------------;
 %put This is macro &sysmacroname;
 %put -------------------------------;

%mend tq84_CompiledMacro;


/* Next day (or in new session).
   The macro is not known anymore, the statement
   throws 
      ERROR 180-322: Statement is not valid or it is used out of proper order. */
%tq84_CompiledMacro

/* Telling SAS, where the stored macros are: */
%let workDir = .... ;
libname libMacro "&workDir/macros";
options
  mstored
  sasmstore=libMacro;

/* The macro is now available */
%tq84_CompiledMacro


/* Since the 'source' options was specified when
   the macro was compiled, the source of the
   macro can be views with the copy statement: */
%copy tq84_CompiledMacro /source; 


proc sql;
   select
     objname as macro_name,
     objdesc,
     created,
     modified
   from
     dictionary.catalogs
   where
     libname = 'LIBMACRO' and
     memname = 'SASMACR'  and
     memtype = 'CATALOG'  and
     objtype = 'MACRO' ;
quit;
Github repository about-SAS, path: /macro-processor/compile/basic.sas

See also

%copy
Options mstored and sasmstore
macros

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Companie...', 1745614926, '3.148.236.97', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Companies-Products/SAS/programming/macros/compiling(106): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78