<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do I call a stored compiled macro? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758289#M239406</link>
    <description>&lt;P&gt;If you want the contents of a Macro to not be ferreted out, SAS does provide the / SECURE option for compiled macros, but one does run the risk of losing the source code and being unable to modify or maintain a macro.&amp;nbsp; See:&amp;nbsp;&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p1nypovnwon4uyn159rst8pgzqrl.htm" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p1nypovnwon4uyn159rst8pgzqrl.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With compiled macros, one also runs the risk of having the source code not match the compile.&amp;nbsp; Someonr could code and compile in development, get everything working, and then move the code to production where for whatever reason it didn't get re-compiled.&amp;nbsp; When some future problem occurs, it may be quite perplexing to debug because the code one is looking at is not the code that was executed.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With auto call macros, what you see is what you get, &lt;STRONG&gt;depending on which library&lt;/STRONG&gt; the macro source code was drawn from. You could run into a problem here if you don't have good implementation procedures.&amp;nbsp; If you have multiple versions of a given macro in the calling chain, the MAUTOLOCDISPLAY option can be really helpful, but it can also give you a really unwieldy log, so use sparingly.&amp;nbsp; If you have macros that call macros that call macros, it can be a bit daunting to trace everything, but sometimes that is what is required during debugging.&amp;nbsp; The SAS MPRINT option can be another friend or it's big cousin MFILE (which is basically the same as MPRINT but writes to a file separate from the log), again used somewhat sparingly; not recommended for production.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
    <pubDate>Thu, 29 Jul 2021 22:07:23 GMT</pubDate>
    <dc:creator>jimbarbour</dc:creator>
    <dc:date>2021-07-29T22:07:23Z</dc:date>
    <item>
      <title>How do I call a stored compiled macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758236#M239380</link>
      <description>&lt;P&gt;I created&amp;nbsp; a compiled stored macro (I think) using this code&lt;/P&gt;
&lt;PRE&gt;libname maclib '\\sasdev\CNM_EG_Projects\macros';
OPTIONS MSTORED SASMSTORE=maclib;

%MACRO adm_mLog_Event( PrjName, PrjTask, Desc ) 
	/STORE
	DES='Log EG events in admData.EG_Event_Times';

%PUT &amp;amp;PrjName ": " &amp;amp;PrjTask ": " &amp;amp;Desc;
libname adm_dta meta library="Admin Data" metaout=data;

%let theTime = %sysfunc(datetime(), datetime20.);
%put &amp;amp;theTime;

data New_Record;
format  Time_of_Day datetime20.;
format ProjectName $40. ProjectTask $40. Description $80.;
	Time_of_Day=input("&amp;amp;theTime",datetime20.);
	ProjectName=&amp;amp;PrjName;
	ProjectTask=&amp;amp;PrjTask;
	Description=&amp;amp;Desc;
run;

proc append base=adm_dta.EG_Event_Times
			data=New_Record;
run;
%MEND;&lt;/PRE&gt;
&lt;P&gt;I then try to call macro in an EG project using this code&lt;/P&gt;
&lt;PRE&gt;libname maclib '\\sasdev\CNM_EG_Projects\macros';
OPTIONS MSTORED SASMSTORE=maclib;

%adm_m_Log_Event( "stored macro test", "Macro Test 4", "Start");
&lt;/PRE&gt;
&lt;P&gt;I get this error in my log&lt;/P&gt;
&lt;PRE&gt;29         OPTIONS MSTORED SASMSTORE=maclib;
WARNING: Apparent invocation of macro ADM_M_LOG_EVENT not resolved.
30         
31         %adm_m_Log_Event( "stored macro test", "Macro Test 4", "Start");
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/PRE&gt;
&lt;P&gt;What am I doing wrong?&lt;/P&gt;
&lt;P&gt;Thanks for your help!&lt;/P&gt;
&lt;P&gt;Jerry&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jul 2021 19:55:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758236#M239380</guid>
      <dc:creator>jblack38</dc:creator>
      <dc:date>2021-07-29T19:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I call a stored compiled macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758237#M239381</link>
      <description>&lt;P&gt;Have you confirmed that the macro compiled correctly?&amp;nbsp; Can you see it when you go into the location you specified in the Libname?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would probably also be useful if the macro in the definition were of the same name as the macro you are calling.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jul 2021 20:04:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758237#M239381</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-07-29T20:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I call a stored compiled macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758241#M239382</link>
      <description>&lt;P&gt;In the location where I saved it there is a file named&lt;/P&gt;
&lt;P&gt;sasmacr.sas7bcat&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jul 2021 20:04:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758241#M239382</guid>
      <dc:creator>jblack38</dc:creator>
      <dc:date>2021-07-29T20:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I call a stored compiled macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758244#M239383</link>
      <description>&lt;P&gt;OK, good.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, look at the name of the macro you're calling vs. the macro you called.&amp;nbsp; Are they the same?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO adm_mLog_Event( PrjName, PrjTask, Desc ) 
%adm_m_Log_Event( "stored macro test", "Macro Test 4", "Start");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Jul 2021 20:06:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758244#M239383</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-07-29T20:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I call a stored compiled macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758250#M239384</link>
      <description>Thank you Jim!&lt;BR /&gt;I'm sorry I didn't look more closely at the code before I submitted a question.  &lt;BR /&gt;Thank you for your patience!&lt;BR /&gt;Jerry</description>
      <pubDate>Thu, 29 Jul 2021 20:11:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758250#M239384</guid>
      <dc:creator>jblack38</dc:creator>
      <dc:date>2021-07-29T20:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do I call a stored compiled macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758254#M239386</link>
      <description>&lt;P&gt;No worries!&amp;nbsp; Sometimes it takes a second pair of eyes.&amp;nbsp; Now, you know my approach:&amp;nbsp; Confirm compilation, then look for errors.&amp;nbsp; Maybe you're already doing that; if so I apologize for belaboring the point.&amp;nbsp; It's just that I've spent a long time sometimes researching some piece of SAS code only to realize that it hadn't compiled correctly in the first place.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Incidentally, I personally have found compiled macros to not be worth the effort.&amp;nbsp; Too many times I've had the library locked when I needed to make a correction or an update.&amp;nbsp; I've also found it to be inflexible, &lt;STRONG&gt;particularly&lt;/STRONG&gt; if you're working on multiple machines.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead, the autocall feature of SAS macros is, to me, the most flexible.&lt;/P&gt;
&lt;P&gt;You would insert your project or group library into the "stack" that SAS maintains.&amp;nbsp; Say you call %adm_mLog_Event.&amp;nbsp; SAS will search for a file named adm_mLog_Event.sas -- case sensitive in UNIX/LINUX -- in the first path.&amp;nbsp; If not found, then SAS will go to the next path, and so on.&amp;nbsp; I do an INSERT and pre-pend my project, personal, or group macro paths as appropriate, and SAS searches my paths before going to the SAS-provided macro paths.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is nice for development because you can prepend your development library &lt;STRONG&gt;in just your session&amp;nbsp;&lt;/STRONG&gt;before your production library.&amp;nbsp; Thus you can test your new code without affecting anyone who needs to use the production version.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Flexible, fast, no locking.&amp;nbsp; The auto-call feature is the best option that I've found.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sample INSERT command of a project library:&lt;/P&gt;
&lt;P&gt;OPTION INSERT = (SasAutos="I:\commercial\&amp;amp;Environment\OPSI\pgm\support_pgm\macro");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jul 2021 20:20:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758254#M239386</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-07-29T20:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I call a stored compiled macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758259#M239387</link>
      <description>I appreciate your reminders.  I usually am very methodical about debugging.  But sometimes I get in a hurry.&lt;BR /&gt;This macro is for our production environment.  One of the articles I read recommended compiled macros for production and autocall was good for development.&lt;BR /&gt;What are your recommendations?</description>
      <pubDate>Thu, 29 Jul 2021 20:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758259#M239387</guid>
      <dc:creator>jblack38</dc:creator>
      <dc:date>2021-07-29T20:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I call a stored compiled macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758269#M239391</link>
      <description>&lt;P&gt;Well, compiled macros are faster -- you don't have to compile them when you run.&amp;nbsp; But I think the speed advantage is pretty minimal.&amp;nbsp; Macros typically compile in a &lt;EM&gt;very&lt;/EM&gt; short period of time.&amp;nbsp; When a macro is brought in via autocall, it is compiled, and the compile persists for the duration of the SAS session.&amp;nbsp; In other words, the macro is &lt;STRONG&gt;not&lt;/STRONG&gt; compiled every time it is executed.&amp;nbsp; If the macro had to be compiled each and every time it was called, then yes, pre-compiled macros might be well worth it.&amp;nbsp; But this is not the case.&amp;nbsp; It is one, typically split-second, compile per session.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suppose that if there were enough macros in a system, that maybe (maybe) pre-compiled macros would improve speed somewhat, perhaps a few seconds.&amp;nbsp; However, usually it is I/O or computation speed, not compilation, that is the limiting factor in job execution time.&amp;nbsp; If one is processing a large amount of data with SAS, the macro compilation time just isn't even in the same category.&amp;nbsp; We have one job that runs about 6 hours.&amp;nbsp; Of that 6 hours, perhaps 3 seconds are consumed by macro compilation (and we use a lot of macros).&amp;nbsp; It's just not worth it to me to have the rigidity of compiled macros vs. the flexibility of auto-call macros to save a few seconds, particularly when those seconds really don't make a meaningful difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have four production SAS environments that I know about, probably more that I don't.&amp;nbsp; It's super nice to be able to just copy a macro from one environment to another and be done.&amp;nbsp; There is no other than step placing the correctly named .sas file in a path that is in the autocall hierarchy.&amp;nbsp; As soon as someone puts a % followed by the macro's name, SAS goes out, retrieves the correspondingly named .sas file from the first path it is included in, and compiles it for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You do need to&amp;nbsp;name the macro the same as the filename -- the exact name -- which is case sensitive in Linux/UNIX.&amp;nbsp; You cannot put multiple macros in one physical file.&amp;nbsp; There needs to be a 1:1 correspondence between macro definitions (i.e. SAS code) and file names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that the recommendation for compiled macros is perhaps old or perhaps made by someone who learned of that advice some time ago.&amp;nbsp; I think the present day SAS compilers (and present day machines) are so fast that macro compile times really aren't relevant in most cases.&amp;nbsp; Now, perhaps if someone had a monster statistical macro that went on for pages that maybe the compile time could be more significant, but I'm thinking that if one is doing that much number crunching that one's SAS job will be computationally bound and that the compile time in comparison to the statistical calculations will be immaterial.&amp;nbsp; I of course have not worked in every shop every where, so maybe there are exceptions, but in practice, I have found little if any down side and lots of up side to using the autocall feature.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jul 2021 21:03:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758269#M239391</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-07-29T21:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I call a stored compiled macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758270#M239392</link>
      <description>Hi Jim,&lt;BR /&gt;I appreciate the detailed reply.  I will definitely give the auto-call a try.  My macros are so small, speed is not an issue.&lt;BR /&gt;Thank you for taking the time to share your expertise.&lt;BR /&gt;Jerry</description>
      <pubDate>Thu, 29 Jul 2021 21:02:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758270#M239392</guid>
      <dc:creator>jblack38</dc:creator>
      <dc:date>2021-07-29T21:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I call a stored compiled macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758272#M239393</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/218244"&gt;@jblack38&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you for taking the time to share your expertise.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Such as it is.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; (although I do do a lot of macro programming)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would be interesting to pose the question here on this forum:&amp;nbsp; What are the advantages and disadvantages of using compiled macros vs. autocall macros?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jul 2021 21:06:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758272#M239393</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-07-29T21:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I call a stored compiled macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758286#M239405</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I haven't needed to use stored compiled macros, but I believe a major advantage (and also a major disadvantage) is that the stored source is no longer needed.&amp;nbsp; So if the macro is proprietary, this probably serves as a type of encryption, a possible advantage.&amp;nbsp; &amp;nbsp; Of course, it means you better have a location where you keep the source for a compiled macro.&amp;nbsp; Otherwise you can have a working macro, whose logic you no longer can asses, a possible disadvantage.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jul 2021 21:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758286#M239405</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-07-29T21:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I call a stored compiled macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758289#M239406</link>
      <description>&lt;P&gt;If you want the contents of a Macro to not be ferreted out, SAS does provide the / SECURE option for compiled macros, but one does run the risk of losing the source code and being unable to modify or maintain a macro.&amp;nbsp; See:&amp;nbsp;&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p1nypovnwon4uyn159rst8pgzqrl.htm" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p1nypovnwon4uyn159rst8pgzqrl.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With compiled macros, one also runs the risk of having the source code not match the compile.&amp;nbsp; Someonr could code and compile in development, get everything working, and then move the code to production where for whatever reason it didn't get re-compiled.&amp;nbsp; When some future problem occurs, it may be quite perplexing to debug because the code one is looking at is not the code that was executed.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With auto call macros, what you see is what you get, &lt;STRONG&gt;depending on which library&lt;/STRONG&gt; the macro source code was drawn from. You could run into a problem here if you don't have good implementation procedures.&amp;nbsp; If you have multiple versions of a given macro in the calling chain, the MAUTOLOCDISPLAY option can be really helpful, but it can also give you a really unwieldy log, so use sparingly.&amp;nbsp; If you have macros that call macros that call macros, it can be a bit daunting to trace everything, but sometimes that is what is required during debugging.&amp;nbsp; The SAS MPRINT option can be another friend or it's big cousin MFILE (which is basically the same as MPRINT but writes to a file separate from the log), again used somewhat sparingly; not recommended for production.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jul 2021 22:07:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758289#M239406</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-07-29T22:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I call a stored compiled macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758411#M239460</link>
      <description>&lt;P&gt;Thanks again Jim for all of your help!&lt;/P&gt;
&lt;P&gt;I finally got all three versions of referencing saved macros working (%include, autocall, compiled and stored), after struggling with syntax.&lt;/P&gt;
&lt;P&gt;I want to post my EG autocall and compiled solutions here, since I found it difficult to find detailed examples in my searches.&amp;nbsp; These worked for me.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To use the autocall feature to reference saved macros, you first have to save the macro code in a .sas in some folder visible from the server.&amp;nbsp; Here is the code for my Log Event macro.&amp;nbsp; I saved the adm_m_Log_Event.sas file in&amp;nbsp;\\sasdev\CNM_EG_Projects\macros.&amp;nbsp; The filename must match the name of the macro.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* 	adm_mLog_Event
	Macro used to log events in admData.EG_Event_Times
	This version is set up to be called using auto-call or % include
*/

%MACRO adm_m_Log_Event( PrjName, PrjTask, Desc );

%PUT &amp;amp;PrjName ": " &amp;amp;PrjTask ": " &amp;amp;Desc;
libname adm_dta meta library="Admin Data" metaout=data;

%let theTime = %sysfunc(datetime(), datetime20.);
%put &amp;amp;theTime;

data New_Record;
format  Time_of_Day datetime20.;
format ProjectName $40. ProjectTask $40. Description $80.;
	Time_of_Day=input("&amp;amp;theTime",datetime20.);
	ProjectName=&amp;amp;PrjName;
	ProjectTask=&amp;amp;PrjTask;
	Description=&amp;amp;Desc;
run;

proc append base=adm_dta.EG_Event_Times
			data=New_Record;
run;
%MEND;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is the code I use to call the macro&lt;/P&gt;
&lt;PRE&gt;OPTIONS 
	mautosource
	SasAutos=('S:\SASdata\CNM_EG_Projects\macros', sasautos)
;

%adm_m_Log_Event( "auto-call macro test 7/30", "Macro Test 1", "Start. ");&lt;/PRE&gt;
&lt;P&gt;Now the code for saving and referencing a stored and compiled macro.&amp;nbsp; Note, the macro definition contains some additional options.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname maclib '\\sasdev\CNM_EG_Projects\macros\macroLib';
OPTIONS MSTORED SASMSTORE=maclib;

%MACRO adm_mLog_Event( PrjName, PrjTask, Desc ) 
	/STORE
	DES='Log EG events in admData.EG_Event_Times';

       &amp;lt; same body as before &amp;gt;

%MEND;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When you run this code, sasmacr.sas7bcat is created in&amp;nbsp;\\sasdev\CNM_EG_Projects\macros\macroLib.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To reference this macro in another program&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;OPTIONS MSTORED SASMSTORE=maclib;
libname maclib 'S:\SASdata\CNM_EG_Projects\macros\macroLib';

%adm_mLog_Event( "stored macro test 7/30", "Macro Test", "Start. Ref S: on SASdev");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It's important to remember that when you're running a program in EG, you are connected to the server.&amp;nbsp; So your code can only see folders that are visible from the server.&lt;/P&gt;
&lt;P&gt;Most of the issues I had were related to typos and not understanding syntax.&amp;nbsp; I still don't fully understand the syntax for updating SASAUTOS.&amp;nbsp; There are lots of different versions I found.&amp;nbsp; The one in my code above is what I got to work.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 14:35:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-call-a-stored-compiled-macro/m-p/758411#M239460</guid>
      <dc:creator>jblack38</dc:creator>
      <dc:date>2021-07-30T14:35:54Z</dc:date>
    </item>
  </channel>
</rss>

