<?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: Why %SYMDEL does not work inside a macro program ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557560#M155447</link>
    <description>Yes I need it to be deleted at the bottom of the loop, inside the macro program.</description>
    <pubDate>Thu, 09 May 2019 18:46:32 GMT</pubDate>
    <dc:creator>Hugo_B</dc:creator>
    <dc:date>2019-05-09T18:46:32Z</dc:date>
    <item>
      <title>Why %SYMDEL does not work inside a macro program ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557507#M155424</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone explain me why the %SYMDEL in the following code results in the message:&lt;BR /&gt;"Warning: Attempt to delete macro variable MV_2 failed. Variable not found."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;%MACRO TEST;
%LET INDEX=2;

DATA _NULL_;
CALL SYMPUT(CATS ("MV_",&amp;amp;INDEX),'ABCDE');
RUN;

%PUT MV_&amp;amp;INDEX &amp;amp;MV_2;
%SYMDEL MV_&amp;amp;INDEX;
%SYMDEL MV_2;

%MEND;
%TEST;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And could you tell me if there is a way to delete a Macro variable in a DATA step, &amp;nbsp;the 'reverse' of CALL SYMPUT.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you .&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 16:41:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557507#M155424</guid>
      <dc:creator>Hugo_B</dc:creator>
      <dc:date>2019-05-09T16:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: Why %SYMDEL does not work inside a macro program ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557512#M155426</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/272343"&gt;@Hugo_B&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can someone explain me why the %SYMDEL in the following code results in the message:&lt;BR /&gt;"Warning: Attempt to delete macro variable MV_2 failed. Variable not found."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;%MACRO TEST;
%LET INDEX=2;

DATA _NULL_;
CALL SYMPUT(CATS ("MV_",&amp;amp;INDEX),'ABCDE');
RUN;

%PUT MV_&amp;amp;INDEX &amp;amp;MV_2;
%SYMDEL MV_&amp;amp;INDEX;
%SYMDEL MV_2;

%MEND;
%TEST;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And could you tell me if there is a way to delete a Macro variable in a DATA step, &amp;nbsp;the 'reverse' of CALL SYMPUT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you .&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;According to the documentation SYMDEL deletes symbols from the GLOBAL symbol table.&amp;nbsp; MV_2 is not global in your macro. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CALL SYMDEL is the data equivalent.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;RTM.&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 16:56:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557512#M155426</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2019-05-09T16:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Why %SYMDEL does not work inside a macro program ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557515#M155428</link>
      <description>&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I use the macro variable "Index" in the CALL SYMDEL Statement&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET INDEX=2;&lt;/P&gt;&lt;P&gt;CALL SYMPUT(CATS("MV_",&amp;amp;INDEX),'ABCD'); working.&lt;/P&gt;&lt;P&gt;CALL SYMDEL (MV_&amp;amp;INDEX); not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 17:00:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557515#M155428</guid>
      <dc:creator>Hugo_B</dc:creator>
      <dc:date>2019-05-09T17:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Why %SYMDEL does not work inside a macro program ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557524#M155430</link>
      <description>&lt;P&gt;You received an answer for this one, but as an addendum, adding the statement: %PUT _ALL_; as last line in your sample code will result in displaying all GLOBAL (globally scoped) macro variables in global symbol table. This statement would also reveal AUTOMATIC macro variables that automatically exist within the SAS session. That statement would help you debug macro scoping issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 17:08:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557524#M155430</guid>
      <dc:creator>ChrisLysholm</dc:creator>
      <dc:date>2019-05-09T17:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: Why %SYMDEL does not work inside a macro program ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557525#M155431</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/272343"&gt;@Hugo_B&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you very much.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I use the macro variable "Index" in the CALL SYMDEL Statement&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%LET INDEX=2;&lt;/P&gt;
&lt;P&gt;CALL SYMPUT(CATS("MV_",&amp;amp;INDEX),'ABCD'); working.&lt;/P&gt;
&lt;P&gt;CALL SYMDEL (MV_&amp;amp;INDEX); not working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What does the dataset variable named MV_2 contain?&amp;nbsp; Does it have the name of the macro you want to delete?&lt;/P&gt;
&lt;P&gt;Perhaps you meant.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CALL SYMDEL ("MV_&amp;amp;INDEX"); &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 May 2019 17:15:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557525#M155431</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-09T17:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: Why %SYMDEL does not work inside a macro program ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557528#M155433</link>
      <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/272343"&gt;@Hugo_B&lt;/a&gt;&amp;nbsp; Use the below call symputx&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CALL SYMPUTX(CATS ("MV_",&amp;amp;INDEX),'ABCDE','g');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;instead of your&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;CALL &lt;SPAN class="token function"&gt;SYMPUT&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;CATS&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"MV_"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;INDEX&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'ABCDE'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 17:20:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557528#M155433</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-05-09T17:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: Why %SYMDEL does not work inside a macro program ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557531#M155435</link>
      <description>&lt;P&gt;Actually I am building a macro program performing a loop, the program create a macro variable INDEX, this macro variable is used to build an other macro Variable DAY_&amp;amp;INDEX, I need the Macro Variable DAY_&amp;amp;INDEX to be deleted at the end of the loop;&lt;BR /&gt;I might probably set to empty : %LET DAY_&amp;amp;INDEX=; instead of deleting it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 17:29:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557531#M155435</guid>
      <dc:creator>Hugo_B</dc:creator>
      <dc:date>2019-05-09T17:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: Why %SYMDEL does not work inside a macro program ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557556#M155443</link>
      <description>&lt;P&gt;You haven't shown your looping logic, but you may not need to do anything.&amp;nbsp; As soon as %TEST finishes executing, &amp;amp;MV_2 is automatically deleted.&amp;nbsp; Do you need it deleted sooner than that?&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 18:31:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557556#M155443</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-05-09T18:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: Why %SYMDEL does not work inside a macro program ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557560#M155447</link>
      <description>Yes I need it to be deleted at the bottom of the loop, inside the macro program.</description>
      <pubDate>Thu, 09 May 2019 18:46:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557560#M155447</guid>
      <dc:creator>Hugo_B</dc:creator>
      <dc:date>2019-05-09T18:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: Why %SYMDEL does not work inside a macro program ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557562#M155449</link>
      <description>&lt;P&gt;I suppose you could always create it as global:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA _NULL_;
CALL SYMPUTX(CATS ("MV_",&amp;amp;INDEX),'ABCDE', 'GLOBAL');
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Once it's global, %SYMDEL will work.&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 18:50:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-SYMDEL-does-not-work-inside-a-macro-program/m-p/557562#M155449</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-05-09T18:50:01Z</dc:date>
    </item>
  </channel>
</rss>

