<?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: Calling saved,compiled MACROS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calling-saved-compiled-MACROS/m-p/534429#M146648</link>
    <description>&lt;P&gt;Save yourself the hassle of compiled macros and use the autocall facility.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also see Maxims 26 &amp;amp; 27.&lt;/P&gt;</description>
    <pubDate>Mon, 11 Feb 2019 12:28:09 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-02-11T12:28:09Z</dc:date>
    <item>
      <title>Calling saved,compiled MACROS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-saved-compiled-MACROS/m-p/534421#M146644</link>
      <description>&lt;P&gt;I am using folowing:&lt;/P&gt;&lt;P&gt;%LET compile_macros = N;&lt;/P&gt;&lt;P&gt;libname optmacro "C:\Codes\Macros";&lt;BR /&gt;options mstored sasmstore=optmacro;&lt;/P&gt;&lt;P&gt;(...)&lt;/P&gt;&lt;P&gt;%IF &amp;amp;compile_macros. = Y %then %do;&lt;BR /&gt;%include "&amp;amp;location.\Codes\02_ Macro - Prediction.sas";&lt;/P&gt;&lt;P&gt;(...)&lt;/P&gt;&lt;P&gt;And&amp;nbsp;02_ Macro - Prediction.sas contains a macro named: macro grade_prediction /store;&lt;/P&gt;&lt;P&gt;Each time I open a new session, in the first run when&amp;nbsp;compile_macros = Y/N, the run is success without any error, but from the second run onwards, I am getting following errors:&lt;/P&gt;&lt;P&gt;ERROR: Unable to clear or re-assign the library OPTMACRO because it is still in use.&lt;BR /&gt;ERROR: Error in the LIBNAME statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am unable to re-assign the library and without it I don't know how to direct SAS to saved/compiled MACROS.&lt;/P&gt;&lt;P&gt;I tried 'libname optmacro&amp;nbsp; CLEAR;' before assignment but to no avail.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea how can I correct these error?&lt;/P&gt;&lt;P&gt;Thanks a lot in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 11:14:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-saved-compiled-MACROS/m-p/534421#M146644</guid>
      <dc:creator>thepushkarsingh</dc:creator>
      <dc:date>2019-02-11T11:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: Calling saved,compiled MACROS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-saved-compiled-MACROS/m-p/534425#M146646</link>
      <description>&lt;P&gt;I have not used compiled macros for a long time and i recommend not to use them at all, as they can cause serious trouble. The error message is afaik caused by&lt;/P&gt;
&lt;PRE&gt;options sasmstore=optmacro;&lt;/PRE&gt;
&lt;P&gt;So resetting sasmstore should solve the issue.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options SASMSTORE='';&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Feb 2019 12:04:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-saved-compiled-MACROS/m-p/534425#M146646</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-02-11T12:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calling saved,compiled MACROS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-saved-compiled-MACROS/m-p/534426#M146647</link>
      <description>&lt;P&gt;You didn't include the &amp;nbsp;"&amp;amp;location.\Codes\02_ Macro - Prediction.sas" ode, so I can&lt;/P&gt;
&lt;P&gt;t be 100% sure, but it looks like you are compiling your macros to a permanent library using code similar to this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname OPTMACRO "some location";
options mstored sasmstore=OPTMACRO;
%macro MyMacro1 /stored;
   /*...more macro code...*/
%mend;
%macro MyMacro2 /stored;
   /*...more macro code...*/
%mend;

/* And after the macro definitions: */
libname OPTMACRO clear;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You'll get the "ERROR: Unable to clear or re-assign the library OPTMACRO because it is still in use" message because SAS is still using the SASMACR catalog in the OPTMACRO library for compiled macro storage. Inserting a %sysmstoreclear&amp;nbsp;macro statement just before trying to clear the OPTMACRO libref should do the trick - something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%sysmstoreclear;
libname OPTMACRO clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;May the SAS be with you!&lt;/P&gt;
&lt;P&gt;Mark&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 12:06:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-saved-compiled-MACROS/m-p/534426#M146647</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2019-02-11T12:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: Calling saved,compiled MACROS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-saved-compiled-MACROS/m-p/534429#M146648</link>
      <description>&lt;P&gt;Save yourself the hassle of compiled macros and use the autocall facility.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also see Maxims 26 &amp;amp; 27.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 12:28:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-saved-compiled-MACROS/m-p/534429#M146648</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-02-11T12:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: Calling saved,compiled MACROS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-saved-compiled-MACROS/m-p/534432#M146649</link>
      <description>&lt;P&gt;Thank you very much for the tip. I'll try SASAUTOS now.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 12:34:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-saved-compiled-MACROS/m-p/534432#M146649</guid>
      <dc:creator>thepushkarsingh</dc:creator>
      <dc:date>2019-02-11T12:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calling saved,compiled MACROS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-saved-compiled-MACROS/m-p/534437#M146650</link>
      <description>I think I am doing exactly like this, but after first run, in the same session all the subsequent runs still give the same error.</description>
      <pubDate>Mon, 11 Feb 2019 12:52:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-saved-compiled-MACROS/m-p/534437#M146650</guid>
      <dc:creator>thepushkarsingh</dc:creator>
      <dc:date>2019-02-11T12:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: Calling saved,compiled MACROS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-saved-compiled-MACROS/m-p/534438#M146651</link>
      <description>I tried this but still same error. I can refrain from using compiled macros, will try autocall. Thanks for the tip.</description>
      <pubDate>Mon, 11 Feb 2019 12:53:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-saved-compiled-MACROS/m-p/534438#M146651</guid>
      <dc:creator>thepushkarsingh</dc:creator>
      <dc:date>2019-02-11T12:53:26Z</dc:date>
    </item>
  </channel>
</rss>

