<?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 how to call execute multiple macros in if/else statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-call-execute-multiple-macros-in-if-else-statement/m-p/447366#M112368</link>
    <description>&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;if 1=1 then&lt;/P&gt;&lt;P&gt;call execute('%extractTable();');&lt;/P&gt;&lt;P&gt;call execute('%scoreUpdate()');&lt;/P&gt;&lt;P&gt;call execute('%writeTable();');&lt;/P&gt;&lt;P&gt;call execute(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; insert into tableA(date,tag)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set date=today(),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tag=1;');&lt;/P&gt;&lt;P&gt;else call execute('%writeIndex();');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;return Error 160-185:no match if-then statement&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the problem is caused &amp;nbsp;calling execute multiple macros..please fix the sas codes..thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 21 Mar 2018 10:45:54 GMT</pubDate>
    <dc:creator>Geo-</dc:creator>
    <dc:date>2018-03-21T10:45:54Z</dc:date>
    <item>
      <title>how to call execute multiple macros in if/else statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-call-execute-multiple-macros-in-if-else-statement/m-p/447366#M112368</link>
      <description>&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;if 1=1 then&lt;/P&gt;&lt;P&gt;call execute('%extractTable();');&lt;/P&gt;&lt;P&gt;call execute('%scoreUpdate()');&lt;/P&gt;&lt;P&gt;call execute('%writeTable();');&lt;/P&gt;&lt;P&gt;call execute(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; insert into tableA(date,tag)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set date=today(),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tag=1;');&lt;/P&gt;&lt;P&gt;else call execute('%writeIndex();');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;return Error 160-185:no match if-then statement&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the problem is caused &amp;nbsp;calling execute multiple macros..please fix the sas codes..thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 10:45:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-call-execute-multiple-macros-in-if-else-statement/m-p/447366#M112368</guid>
      <dc:creator>Geo-</dc:creator>
      <dc:date>2018-03-21T10:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: how to call execute multiple macros in if/else statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-call-execute-multiple-macros-in-if-else-statement/m-p/447368#M112369</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;Since you are not reading values from an input dataset, there is no need here for a data step with call execute instructions. You can directly call your macros :&lt;BR /&gt;&lt;BR /&gt;%extractTable();&lt;BR /&gt;%scoreUpdate()&lt;BR /&gt;...</description>
      <pubDate>Wed, 21 Mar 2018 10:56:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-call-execute-multiple-macros-in-if-else-statement/m-p/447368#M112369</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-03-21T10:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: how to call execute multiple macros in if/else statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-call-execute-multiple-macros-in-if-else-statement/m-p/447373#M112371</link>
      <description>&lt;P&gt;As for the error you mentionned, if several instructions have to be executed when a given condition is met, they have to be enclosed by do;...end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if (&amp;lt;condition&amp;gt;)&amp;nbsp; then do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;instruction1&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;instruction2&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ...&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 11:05:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-call-execute-multiple-macros-in-if-else-statement/m-p/447373#M112371</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-03-21T11:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to call execute multiple macros in if/else statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-call-execute-multiple-macros-in-if-else-statement/m-p/447382#M112373</link>
      <description>&lt;P&gt;One version:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;if 1=1 then&lt;/P&gt;
&lt;P&gt;call execute&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ('&amp;nbsp; %nrstr( %extractTable() %scoreUpdate() %writeTable() )&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;proc sql noprint;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; insert into tableA(date,tag)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set date=today(),&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tag=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;');&lt;/P&gt;
&lt;P&gt;else call execute('%nrstr(%writeIndex())');&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's possible that adding %NRSTR is overkill and unnecessary.&amp;nbsp; But there's no way to know without seeing the contents of the four macros.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider whether a QUIT statement should be added at the end of PROC SQL.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 11:45:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-call-execute-multiple-macros-in-if-else-statement/m-p/447382#M112373</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-03-21T11:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to call execute multiple macros in if/else statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-call-execute-multiple-macros-in-if-else-statement/m-p/447384#M112374</link>
      <description>&lt;P&gt;The use of %nrstr depends on the contents of the macros. If they only have macro variables/parameters used, %nrstr is not needed. But if there's logic in there (%if %then %else), or steps that create macro variables for later use, you can get into timing problems, as macro statements will be executed as soon as they are pushed onto the execution stack, while data or proc steps cannot run before the current data step finishes.&lt;/P&gt;
&lt;P&gt;%nrstr prevents such premature resolution of macros.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 11:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-call-execute-multiple-macros-in-if-else-statement/m-p/447384#M112374</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-21T11:53:51Z</dc:date>
    </item>
  </channel>
</rss>

