<?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: Error when deleting global macro variables in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/826830#M41207</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Yes, I just want to delete the global macro variables that I have defined. But I could not find another way to delete just the ones I defined.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Wed, 03 Aug 2022 11:32:25 GMT</pubDate>
    <dc:creator>madara155</dc:creator>
    <dc:date>2022-08-03T11:32:25Z</dc:date>
    <item>
      <title>Error when deleting global macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/826784#M41202</link>
      <description>&lt;P&gt;I have been using the following bit of code to delete the Global macro variables.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;%macro delvars;&lt;/FONT&gt;&lt;BR /&gt;data vars;&lt;BR /&gt;set sashelp.vmacro;&lt;BR /&gt;run;&lt;BR /&gt;data _null_;&lt;BR /&gt;set vars;&lt;BR /&gt;if scope='&lt;FONT color="#FF99CC"&gt;GLOBAL&lt;/FONT&gt;' then call execute('&lt;FONT color="#FF99CC"&gt;%symdel&lt;/FONT&gt; '&lt;BR /&gt;||trim(left(name))||';');&lt;BR /&gt;run;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;%mend;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Recently started getting the following two errors: (rest of the global macro variables seems to get deleted)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR: Attempt to delete automatic macro variable SYS_SQL_IP_ALL.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR: Attempt to delete automatic macro variable SYS_SQL_IP_STMT.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I have no idea what these are. Any thoughts?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Thanks&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 05:02:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/826784#M41202</guid>
      <dc:creator>madara155</dc:creator>
      <dc:date>2022-08-03T05:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Error when deleting global macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/826790#M41203</link>
      <description>&lt;P&gt;Maxim 6: Google Is Your Friend.&lt;/P&gt;
&lt;P&gt;A search for the names of these variables reveals that they are set by PROC SQL and cannot be deleted.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 06:03:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/826790#M41203</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-08-03T06:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: Error when deleting global macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/826795#M41204</link>
      <description>&lt;P&gt;Is there a reason you want to delete macro variables set by Proc SQL?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 06:35:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/826795#M41204</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-08-03T06:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Error when deleting global macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/826824#M41206</link>
      <description>&lt;P&gt;One suspects that what you really are attempting to get to are the _USER_ defined variables, i.e. create by you, that are also Global in scope.&lt;/P&gt;
&lt;P&gt;If that is the case then please say so.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 10:10:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/826824#M41206</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-08-03T10:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: Error when deleting global macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/826830#M41207</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Yes, I just want to delete the global macro variables that I have defined. But I could not find another way to delete just the ones I defined.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 11:32:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/826830#M41207</guid>
      <dc:creator>madara155</dc:creator>
      <dc:date>2022-08-03T11:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: Error when deleting global macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/826833#M41208</link>
      <description>&lt;P&gt;If your naming convention for macro variables follows the recommendation of item 7 in &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p0b1hb28lkv9ujn1dfjj0xaddymb.htm#n1rkm1bggxs35sn1ciu3q0mdueqq" target="_blank" rel="noopener"&gt;Creating User-Defined Macro Variable Names&lt;/A&gt;&amp;nbsp;-- "&lt;SPAN&gt;&lt;EM&gt;The prefixes AF, DMS, SQL, and SYS are not recommended ...&lt;/EM&gt;" --, you can exclude those prefixes in your IF condition:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4"&gt;if scope='GLOBAL' &lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;&amp;amp; name ~in: ('AF' 'DMS' 'SQL' 'SYS')&lt;/STRONG&gt;&lt;/FONT&gt; then ...&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Aug 2022 12:07:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/826833#M41208</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-08-03T12:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: Error when deleting global macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/826834#M41209</link>
      <description>&lt;P&gt;Unfortunately, this is a hard task.&amp;nbsp; Many of the clients (EG, Studio, etc) litter the global symbol table with macro variables, which makes it difficult to know which are "yours".&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That said, there is a tech support note which says that macro variables starting with SYS and AF are reserved name spaces, so I delete everything but those:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set sashelp.vmacro;
  where scope='GLOBAL' and offset=0 and name not like "SYS%" and name not like "AF%";  
  call execute('%nrstr(%%)symdel '||trim(left(name))||';');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the macro variables you can't delete, it is possible to set them to null:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set sashelp.vmacro;
  where scope='GLOBAL' and offset=0 and (name like "SYS%" or name like "AF%");  
  call execute('%nrstr(%%)let '||trim(left(name))||'=;');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Aug 2022 12:12:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/826834#M41209</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-08-03T12:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Error when deleting global macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/826902#M41212</link>
      <description>&lt;P&gt;Here's one more change I would recommend.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if scope='GLOBAL' and offset=0 and .....&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Macro variables within sashelp.vmacro do not necessarily appear in just one observation.&amp;nbsp; They get stored in 200-character chunks.&amp;nbsp; So you may be trying to delete long macro variables twice.&amp;nbsp; Or more than twice.&amp;nbsp; Adding OFFSET=0 as a condition selects just one occurrence of the macro variable within sashelp.vmacro, and only attempts to delete the macro variable once.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 15:06:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/826902#M41212</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-08-03T15:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: Error when deleting global macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/827260#M41217</link>
      <description>Thanks for your kind support! Appreciate it!</description>
      <pubDate>Thu, 04 Aug 2022 22:50:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-when-deleting-global-macro-variables/m-p/827260#M41217</guid>
      <dc:creator>madara155</dc:creator>
      <dc:date>2022-08-04T22:50:30Z</dc:date>
    </item>
  </channel>
</rss>

