<?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: SAS Macros: Changing/Updating SASAUTOS During SAS Session in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macros-Changing-Updating-SASAUTOS-During-SAS-Session/m-p/758764#M239656</link>
    <description>&lt;P&gt;Sounds like you are asking how to remove the already compiled macros so that the next call that same macro name will find the macro definition using the new search path.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS has provided a macro command for deleting a compiled macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a user defined macro that makes using it easier:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/sasutils/macros/blob/master/macdelete.sas" target="_blank"&gt;https://github.com/sasutils/macros/blob/master/macdelete.sas&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Aug 2021 12:06:39 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-08-02T12:06:39Z</dc:date>
    <item>
      <title>SAS Macros: Changing/Updating SASAUTOS During SAS Session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macros-Changing-Updating-SASAUTOS-During-SAS-Session/m-p/758749#M239647</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using the SASAUTOS option to recall macros, without having to use the %INCLUDE statements and this working perfectly, but when I decide to change the SASAUTOS option mid-session it does not change.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, this causes an issue because imagine there were two macro locations, call them M_LIB1 and M_LIB2, which both contain the macro MYMACRO. When I open SAS and define the SASAUTOS to look at the MYMACRO in M_LIB1, it works as expected. Then I decide to change the SASAUTOS location to M_LIB2, during my current session, (i.e., I do not close SAS), the SASAUTOS does not seem to change and when I call MYMACRO expecting to be recalled from M_LIB2, it is actually being recalled from M_LIB1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is some basic an example code, where I define the SASAUTOS location, call the macro then print the SASAUTOS locations to the log, then change the SASAUTOS location and repeat:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
options mrecall mautosource 
        set = sasautos("!sasroot\core\sasmacro"
                       "C:\m_lib1");
%mymacro;
filename sasautos list;

                       
options mrecall mautosource 
        set = sasautos("!sasroot\core\sasmacro"
                       "C:\m_lib2");
%mymacro;
filename sasautos list;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The issue is that the FILENAME code with the LIST option displays the same results for both which implies SASAUTOS is not changing, I was expecting the second statement to show the M_LIB2 path but it shows the M_LIB1 path. Can anyone help?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 11:18:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macros-Changing-Updating-SASAUTOS-During-SAS-Session/m-p/758749#M239647</guid>
      <dc:creator>craig159753</dc:creator>
      <dc:date>2021-08-02T11:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macros: Changing/Updating SASAUTOS During SAS Session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macros-Changing-Updating-SASAUTOS-During-SAS-Session/m-p/758750#M239648</link>
      <description>&lt;P&gt;Works for me if you remove &lt;FONT face="courier new,courier"&gt;set =&lt;/FONT&gt; from the &lt;FONT face="courier new,courier"&gt;options&lt;/FONT&gt; statement. And then use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put %sysfunc(getoption(sasautos));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;instead of the filename command.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your options statement changes the value of the &lt;FONT color="#FF0000"&gt;option&lt;/FONT&gt; sasautos, it is not changing the the meaning of the &lt;FONT color="#FF0000"&gt;fileref&lt;/FONT&gt; sasautos&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 11:39:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macros-Changing-Updating-SASAUTOS-During-SAS-Session/m-p/758750#M239648</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-02T11:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macros: Changing/Updating SASAUTOS During SAS Session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macros-Changing-Updating-SASAUTOS-During-SAS-Session/m-p/758761#M239653</link>
      <description>&lt;P&gt;Hi Paige,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you are suggesting the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mrecall mautosource 
        sasautos=("!sasroot\core\sasmacro"
                       "C:\M_LIB1");
%put %sysfunc(getoption(sasautos));
%mymacro;
                       
options mrecall mautosource 
        sasautos=("!sasroot\core\sasmacro"
                       "C:\M_LIB2");
%put %sysfunc(getoption(sasautos));
%mymacro;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which yes does show two different SASAUTOS options, however the macro called is from M_LIB1 exclusively, it seems the second location does not take priority even when SASAUTOS is redefined.&lt;BR /&gt;&lt;BR /&gt;I have also tried the following&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
%sysmstoreclear;
proc catalog catalog = work.sasmacr kill force;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which would clear the work areas, and still no luck&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 12:01:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macros-Changing-Updating-SASAUTOS-During-SAS-Session/m-p/758761#M239653</guid>
      <dc:creator>craig159753</dc:creator>
      <dc:date>2021-08-02T12:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macros: Changing/Updating SASAUTOS During SAS Session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macros-Changing-Updating-SASAUTOS-During-SAS-Session/m-p/758764#M239656</link>
      <description>&lt;P&gt;Sounds like you are asking how to remove the already compiled macros so that the next call that same macro name will find the macro definition using the new search path.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS has provided a macro command for deleting a compiled macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a user defined macro that makes using it easier:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/sasutils/macros/blob/master/macdelete.sas" target="_blank"&gt;https://github.com/sasutils/macros/blob/master/macdelete.sas&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 12:06:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macros-Changing-Updating-SASAUTOS-During-SAS-Session/m-p/758764#M239656</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-02T12:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macros: Changing/Updating SASAUTOS During SAS Session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macros-Changing-Updating-SASAUTOS-During-SAS-Session/m-p/758766#M239658</link>
      <description>&lt;P&gt;Once you call %mymacro, it remains known to SAS for that entire SAS session (that is, until you close SAS). So changing the SASAUTOS option doesn't affect %mymacro, the SAS system still knows about it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%sysmacdelete mymacro/nowarn;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Aug 2021 12:14:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macros-Changing-Updating-SASAUTOS-During-SAS-Session/m-p/758766#M239658</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-02T12:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macros: Changing/Updating SASAUTOS During SAS Session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macros-Changing-Updating-SASAUTOS-During-SAS-Session/m-p/758769#M239659</link>
      <description>&lt;P&gt;Hi Paige and Tom,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help, using the SYSMACDELETE it works, so I made a rough macro to delete specifically the work macros, as I do not need any of them if I am changing the SASAUTOS option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
%* Reset / Remove any work macro(s);
%macro m_reset();

  %local m_work_macros m_work_macro;
  %let m_work_macros=;
  %let m_work_macro=;

  %* Fetch work macro(s) previously compiled;
  proc sql noprint;
    select distinct strip(objname) &lt;BR /&gt;    into :m_work_macros separated by " " from sashelp.vcatalg
    where upcase(objtype)="MACRO" and upcase(libname)="WORK" and compress(upcase(objname)) ne "M_RESET";
  quit;


  %* Loop through work macro(s) previously compiled and remove them;
  %if %length(&amp;amp;m_work_macros.) &amp;gt; 0 %then %do;
    %do i = 1 %to %sysfunc(countw(&amp;amp;m_work_macros.)) %by 1;

    %* Define macro;
    %let m_work_macro = %scan(&amp;amp;m_work_macros., &amp;amp;i.);

      %* Ignore current macro / null terms;
      %if %upcase(&amp;amp;m_work_macro.) ne M_RESET and %length(&amp;amp;m_work_macro.)&amp;gt;0 %then %do;
        %put NO%STR(TE:) Following work macro removed - %upcase(&amp;amp;m_work_macro.);
        %sysmacdelete &amp;amp;m_work_macro. / nowarn;
      %end;

    %end;

  %end;

%mend m_reset;
%m_reset;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Aug 2021 12:39:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macros-Changing-Updating-SASAUTOS-During-SAS-Session/m-p/758769#M239659</guid>
      <dc:creator>craig159753</dc:creator>
      <dc:date>2021-08-02T12:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macros: Changing/Updating SASAUTOS During SAS Session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macros-Changing-Updating-SASAUTOS-During-SAS-Session/m-p/758771#M239660</link>
      <description>&lt;P&gt;I think the key point is that MRECALL does not do what you hoped it would do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you hoped that MRECALL would mean "every time I call a macro, look in the autocall libraries to see if there is a .sas file for the macro and re-compile it."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead, MRECALL means "when I call a macro &lt;STRONG&gt;that has is not currently compiled&lt;/STRONG&gt;, even if earlier in the session I looked in the autocall libraries for it, look again."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For development purposes, it might be nice to have a SUPERMRECALL that would do what you want.&amp;nbsp; Without that, as others have mentioned, to get an autocall macro to re-compile, your options are either to delete definition from the compiled macro catalog, or to %include the macro code.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 12:45:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macros-Changing-Updating-SASAUTOS-During-SAS-Session/m-p/758771#M239660</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2021-08-02T12:45:02Z</dc:date>
    </item>
  </channel>
</rss>

