<?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: Reset all %macro before execution in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174286#M33471</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the Macro statement :&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword"&gt;%SYMDEL&lt;/SPAN&gt; &lt;SPAN class="userSuppliedSyntaxValue"&gt;macro-variable-1 &amp;lt;...macro-variable-n&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="argOptional"&gt;&amp;lt;/option&amp;gt;&lt;/SPAN&gt; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Jul 2014 07:20:14 GMT</pubDate>
    <dc:creator>Trancho</dc:creator>
    <dc:date>2014-07-10T07:20:14Z</dc:date>
    <item>
      <title>Reset all %macro before execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174284#M33469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear expert&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I would like to reset all previously declared %macro so as to avoid macros storing memory variables wrongly to be referred in each SAS program execution.&amp;nbsp; Should I set OPTIONS MSTORED or NOMSTORED, or specifically set local % in the program.&amp;nbsp; Thank you for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;may&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 04:56:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174284#M33469</guid>
      <dc:creator>wongmay</dc:creator>
      <dc:date>2014-07-10T04:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Reset all %macro before execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174285#M33470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;NOMSTORED&lt;/SPAN&gt; option not to store the variables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 07:03:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174285#M33470</guid>
      <dc:creator>Vish33</dc:creator>
      <dc:date>2014-07-10T07:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Reset all %macro before execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174286#M33471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the Macro statement :&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword"&gt;%SYMDEL&lt;/SPAN&gt; &lt;SPAN class="userSuppliedSyntaxValue"&gt;macro-variable-1 &amp;lt;...macro-variable-n&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="argOptional"&gt;&amp;lt;/option&amp;gt;&lt;/SPAN&gt; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 07:20:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174286#M33471</guid>
      <dc:creator>Trancho</dc:creator>
      <dc:date>2014-07-10T07:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: Reset all %macro before execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174287#M33472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Suppose I have macros, say&lt;/P&gt;&lt;P&gt;&amp;nbsp; %macro test_1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x=123;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %mend test_1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&amp;nbsp; %let test_2=123;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Should I write the syntax at the very begining in the program to delete such macros before SAS execution :&lt;/P&gt;&lt;P&gt;&amp;nbsp; %SYMDEL test_1 test_2 /nowarn;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;may&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 08:48:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174287#M33472</guid>
      <dc:creator>wongmay</dc:creator>
      <dc:date>2014-07-10T08:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Reset all %macro before execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174288#M33473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sydel command will only delete macro variables, not macros themselves.&amp;nbsp; So in your example, %symdel test2 / nowarn;&amp;nbsp; would be fine, but you can't use that for test_1.&amp;nbsp; As for the macro code, well, this really is all down to organization, and is my biggest gripe with the macro system.&amp;nbsp; I would suggest be explicit in which macro code you are including, too often I see:&lt;/P&gt;&lt;P&gt;File a:&lt;/P&gt;&lt;P&gt;%macro test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data a;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aaa="Hello";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;%mend test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;File b:&lt;/P&gt;&lt;P&gt;%macro test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data a;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aaa="World";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;%mend test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;File c:&lt;/P&gt;&lt;P&gt;%include file_a;&lt;/P&gt;&lt;P&gt;%do_something;&lt;/P&gt;&lt;P&gt;%test; /* AAA is Hello */&lt;/P&gt;&lt;P&gt;%include_another_program;&amp;nbsp; /* This has the line %include file_b */&lt;/P&gt;&lt;P&gt;%test;&amp;nbsp; /* AAA is World */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And debugging means trawling through layers of include statements, macro defs, scope etc.&amp;nbsp; For some coding you can use call execute to generate code at run-time, hence avoiding using macro variables/macros at all.&amp;nbsp; Otherwise its really up to you to ensure your macro call is correct.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 09:23:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174288#M33473</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-07-10T09:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: Reset all %macro before execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174289#M33474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Most of the time we write so many macros %LET and %include within the programs and forget how many of them have been stated.&amp;nbsp; I simply quit SAS and invoke again in order to refresh all macro settings before execution.&amp;nbsp; Could anyone tell me the simpliest way to handle this ?&amp;nbsp; Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;may&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 09:53:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174289#M33474</guid>
      <dc:creator>wongmay</dc:creator>
      <dc:date>2014-07-10T09:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Reset all %macro before execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174290#M33475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep, follow good programming guidance / structured programming.&amp;nbsp; E.g. declare macro variables either at the start of the program, for global ones, or within their scope for local ones.&amp;nbsp; Store macros with guidance documentation in a protected library area, so you can ensure the ones you use are validated ones.&amp;nbsp; Many other things can help organize the code and make it more readable/maintainable and their are several website dedicated to this topic although this type of thing doesn't seem to have come to SAS programming that much as yet:&lt;/P&gt;&lt;P&gt;Wikipedia definition: &lt;A href="http://en.wikipedia.org/wiki/Best_Coding_Practices"&gt;http://en.wikipedia.org/wiki/Best_Coding_Practices&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also run your programs in batch mode, this means tha SAS would startup, run your program, then close - hence not keeping over anything from previous runs.&amp;nbsp; Other than that I don't think there is a (at least simple) way of cleaning you SAS run.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 10:26:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174290#M33475</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-07-10T10:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Reset all %macro before execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174291#M33476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Start a new SAS session and run below code. This might give you an idea how many macros are already pre-compiled and waiting for you without you having run explicitly a single line of code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same is true if you then execute a "%put _all_;" as the very first command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So: To not use macros &amp;amp; macro variable values in a wrong version or state is mainly about clean program design. If I develop in EG then one of my last tests is always running the program after spawning a new session (disconnect/reconnect to the server). And if it's serious code then I run it also in batch-mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put I exist;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/** list catalogs in a specific library **/&lt;/P&gt;&lt;P&gt;proc datasets library=work memtype=catalog;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/** list all macros in all libraries and catalogs **/&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select *&lt;/P&gt;&lt;P&gt;&amp;nbsp; from dictionary.catalogs&lt;/P&gt;&lt;P&gt;&amp;nbsp; where memtype='CATALOG' and objtype='MACRO'&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/** delete a macro in a catalog **/&lt;/P&gt;&lt;P&gt;proc catalog cat=work.sasmac1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; contents;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp; delete test / entrytype=macro;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp; contents;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 11:07:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174291#M33476</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-07-10T11:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: Reset all %macro before execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174292#M33477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This thread basically illustrates a huge amount of confusion about macros. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Macro design is key&lt;/P&gt;&lt;P&gt;2) The process of writing macros involves isolating the VALUES from the PROCESS. The macro abstracts the process. You supply the variables in 2 ways:&lt;/P&gt;&lt;P&gt;a) Using %LET&lt;/P&gt;&lt;P&gt;b) Passing values in as arguments and defining the macro variables as parameters&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, if you have &lt;/P&gt;&lt;P&gt;%let dset=a;&lt;/P&gt;&lt;P&gt;%let iv=a b c d e;&lt;/P&gt;&lt;P&gt;proc reg data=&amp;amp;dset;&lt;/P&gt;&lt;P&gt;model dv=&amp;amp;iv;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should be rewritten, and the %let statements ELIMINATED. Write&lt;/P&gt;&lt;P&gt;%macro runreg(dset=,iv=);&lt;/P&gt;&lt;P&gt;proc reg data=&amp;amp;dset;&lt;/P&gt;&lt;P&gt;model dv=&amp;amp;iv;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend runreg;&lt;/P&gt;&lt;P&gt;%runreg(dset=a,iv=a b c d e)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This AUTOMATICALLY resets the macro variables, because they are defined in the macro call.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 12:54:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174292#M33477</guid>
      <dc:creator>PaulAThompson</dc:creator>
      <dc:date>2014-07-10T12:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: Reset all %macro before execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174293#M33478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Best is to just start a new SAS session.&lt;/P&gt;&lt;P&gt;How to remove previously compiled macros definitions depends partly on how you are storing your compiled macros.&amp;nbsp; If you are just using basic SAS defaults then the compiled macros will be in the WORK catalog named SASMACR.&amp;nbsp; But with older versions of Enterprise Guide I did notice that it also seemed to create a catalog named SASMAC1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;proc catalog c=work.sasmacr force kill;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;You also might want to remove any previously compiled formats from WORK.FORMATS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;proc catalog c=work.formats force kill;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 13:10:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174293#M33478</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-07-10T13:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Reset all %macro before execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174294#M33479</link>
      <description>&lt;P&gt;&lt;EM&gt;Editor's note: Many great solutions mentioned but to properly delete a macro variable you would use %SYMDEL and to properly remove a macro compiled to the WORK catalog you would use %SYSMACDELETE as metioned by &lt;A class="lia-link-navigation lia-page-link lia-user-name-link" id="link_10" style="color: rgb(0, 125, 195);" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/7755" target="_self"&gt;&lt;SPAN&gt;gergely_batho&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See also:&lt;/P&gt;
&lt;P&gt;&lt;A id="p0q0bl679j548sn1ms225tab8y9h" target="_blank"&gt;&lt;/A&gt;%SYSMACDELETE;&lt;/P&gt;
&lt;P&gt;&lt;A id="p0cdwmdp3dmzvxn1h1b4kudjwx87" target="_blank"&gt;&lt;/A&gt;%SYSMSTORECLEAR;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 18:44:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174294#M33479</guid>
      <dc:creator>gergely_batho</dc:creator>
      <dc:date>2017-08-14T18:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Reset all %macro before execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174295#M33480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For macro variables, I use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set sashelp.vmacro;&lt;/P&gt;&lt;P&gt;&amp;nbsp; where scope='GLOBAL' and offset=0 and name not like "SYS%" and name not like "AF%";&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; call execute('%nrstr(%%)symdel '||trim(left(name))||';');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Set variables that start with SYS or AF to null, since we cant delete them;&lt;/P&gt;&lt;P&gt;*Oddly, macro variable SYS_SQL_IP_ALL (created by PROC SQL) stores a dot when it is set to null.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set sashelp.vmacro;&lt;/P&gt;&lt;P&gt;&amp;nbsp; where scope='GLOBAL' and offset=0 and (name like "SYS%" or name like "AF%");&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; call execute('%nrstr(%%)let '||trim(left(name))||'=;');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For macros I use Tom's PROC CATALOG approach.&amp;nbsp;&amp;nbsp; Of course there is lots more you may want to clear if you spend a day or more in an interactive SAS session (work datasetsets, templates, format catalogs, titles, etc etc).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I mostly use that in interactive PC SAS.&amp;nbsp; Sometimes EG doesn't like it when I delete everything, because it relies on some macro variables and even some work datasets for its own use.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And whether EG or PC SAS, keep in mind that interactive sessions should just be for development (IMHO), even if you have a nice %CleanSession() macro.&amp;nbsp; Production runs should be done in batch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 17:23:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174295#M33480</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2014-07-10T17:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: Reset all %macro before execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174296#M33481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's SASMAC1 for me using EG6.1 with SAS9.4 under Win7 64bit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 22:07:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174296#M33481</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-07-10T22:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: Reset all %macro before execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174297#M33482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's so great !&amp;nbsp; Thank you all of you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;may&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 23:36:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reset-all-macro-before-execution/m-p/174297#M33482</guid>
      <dc:creator>wongmay</dc:creator>
      <dc:date>2014-07-10T23:36:46Z</dc:date>
    </item>
  </channel>
</rss>

