LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (September 1998, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 1 Sep 1998 10:07:36 -0400
Reply-To:   "Fehd, Ronald J." <rjf2@CDC.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   "Fehd, Ronald J." <rjf2@CDC.GOV>
Subject:   Re: SAS Autocall macro
Content-Type:   text/plain

> jensenk@my-dejanews.com wrote: > > > Does anyone have any good examples (or know where some are) of creating > > Autocall Libraries? I have the Macro book but there are not any > examples and > > it is a little terse for me. What I would like to do is have a macro > that I > > can call from any SAS program. That way the info in the Macro only has > to be > > updated in one place rather than each program that uses the information. > You may want to read about the store option for macros. refer to: SAS Macro Language Reference, 1E. SAS Macro Facility Tips and Techniques, pg 101

This option compiles the macro and saves it to a library catalog named SASMACRO. Your autoexec should have the the following statements:

%*AUTOEXEC.SAS; filename SASAUTOS (<fileref>, SASAUTOS); filename SASAUTOS list;%*check to see where your macros are;

libname LIBRARY "<libref>"; options SASMStore=LIBRARY MautoSource MStored; libname LIBRARY list;%*check to see where your library is;

Your macro should have the following option. %*WHATEVER.SAS; %macro WHATEVER(<parm-list>)/store;

You will have to initialize the SASMACRO catalog for your library. This is done with a program that %includes each macro with the store option.

%*MACROINI.SAS; %INCLUDE SASAUTOS(<macro-name>);

A note on the filename SASAUTOS and CONFIG.SAS: If you have access to your directory where SAS.exe is stored, you may create a directory to contain your custom macros, and add that directory to the list in your CONFIG.SAS

-SET SASAUTOS ( <file-ref> !sasext0\base\sasmacro !sasroot\core\sasmacro )

Alternately you may define a filename SASAUTOS in your autoexec; see example above. %*use custom macros more:;filename SASAUTOS (<fileref>, SASAUTOS); %*use SAS-supplied macros more:;filename SASAUTOS (SASAUTOS, <fileref>); %*not use SAS-supplied macros :;filename SASAUTOS (<fileref>);

Remember that once you have updated any macro, that you must go around to all your projects and run the MACROINI program in order to store the latest version of the macro(s).

Ah Ha! Well, I'm glad I said that. One could define a separate library for the SASMACRO catalog, add that libname and option SASMstore to the autoexec: libname SASMACRO "<libref>"; options SASMStore=SASMACRO MautoSource MStored;

Benefits: run MACROINI once and update macros for all projects. Drawbacks: sharing violations occur when two SAS sessions access the SASMACRO catalog. There may be a way around that, which others can address.

It's a good thing to answer questions here.

Ron Fehd the macro maven CDC Atlanta GA


Back to: Top of message | Previous page | Main SAS-L page