<?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: Execute macro even if no rows is selected in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Execute-macro-even-if-no-rows-is-selected/m-p/607267#M176479</link>
    <description>Any other ways to solve the problem?&lt;BR /&gt;</description>
    <pubDate>Tue, 26 Nov 2019 10:54:18 GMT</pubDate>
    <dc:creator>David_Billa</dc:creator>
    <dc:date>2019-11-26T10:54:18Z</dc:date>
    <item>
      <title>Execute macro even if no rows is selected</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Execute-macro-even-if-no-rows-is-selected/m-p/607261#M176475</link>
      <description>&lt;P&gt;When I try to execute the code below, I'm getting error stating that ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;WARNING: Apparent symbolic reference MAC_LIST not resolved.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I would like to execute the macro even when the macro &lt;EM&gt;MAC_LIST&amp;nbsp; &lt;/EM&gt;is not resolved. I don't want to see the error and also I want program to continue processing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data &amp;amp;_OUTPUT.(keep= FLT_ID RUN_ID);
	set &amp;amp;_INPUT.;
        &amp;amp;mac_list.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Nov 2019 10:40:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Execute-macro-even-if-no-rows-is-selected/m-p/607261#M176475</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2019-11-26T10:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Execute macro even if no rows is selected</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Execute-macro-even-if-no-rows-is-selected/m-p/607265#M176478</link>
      <description>&lt;P&gt;You could ensure that the macro variable always exists, i.e. by adding the following before your datastep.&lt;/P&gt;
&lt;P&gt;%global mac_list;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 10:48:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Execute-macro-even-if-no-rows-is-selected/m-p/607265#M176478</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-11-26T10:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: Execute macro even if no rows is selected</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Execute-macro-even-if-no-rows-is-selected/m-p/607267#M176479</link>
      <description>Any other ways to solve the problem?&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Nov 2019 10:54:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Execute-macro-even-if-no-rows-is-selected/m-p/607267#M176479</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2019-11-26T10:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Execute macro even if no rows is selected</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Execute-macro-even-if-no-rows-is-selected/m-p/607270#M176480</link>
      <description>&lt;P&gt;Not as simple as using a %global statement (or a %local statement within a macro definition).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your code is within a SAS macro definition then you can also use %symexist as below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*%let mac_list= newvar=1;*/

%macro test();
  data sample;
    set sashelp.class;
    %if %symexist(mac_list) %then &amp;amp;mac_list; ;
  run;
%mend;
%test();

proc print data=sample;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 11:37:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Execute-macro-even-if-no-rows-is-selected/m-p/607270#M176480</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-11-26T11:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Execute macro even if no rows is selected</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Execute-macro-even-if-no-rows-is-selected/m-p/607279#M176485</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292396"&gt;@David_Billa&lt;/a&gt;&amp;nbsp;thanks for supplying the code and the error message, as it helps coming up with a solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If any of&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;'s responses works for you then please accept it (not my post) as the solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; kind regards,&lt;/P&gt;&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 11:33:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Execute-macro-even-if-no-rows-is-selected/m-p/607279#M176485</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2019-11-26T11:33:05Z</dc:date>
    </item>
  </channel>
</rss>

