<?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: Can I call/execute macro within a DO loop? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-I-call-execute-macro-within-a-DO-loop/m-p/246502#M46131</link>
    <description>&lt;P&gt;Sort&lt;EM&gt;&lt;U&gt;&lt;/U&gt;&amp;nbsp;&lt;/EM&gt;of, you need to use a routine to call the macro - routine is CALL EXECUTE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Generate the text and pass it to call execute &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jan 2016 23:48:45 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-01-27T23:48:45Z</dc:date>
    <item>
      <title>Can I call/execute macro within a DO loop?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-call-execute-macro-within-a-DO-loop/m-p/246501#M46130</link>
      <description>&lt;P&gt;Can I call/execute macro within a DO loop?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;something like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;TT&gt;data TWO; set ONE;&lt;/TT&gt; &lt;BR /&gt;&lt;TT&gt;&amp;nbsp;&amp;nbsp;do until(last.ID)&lt;/TT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;%macro( some variable in&amp;nbsp;&lt;SPAN&gt;TWO&lt;/SPAN&gt;, &amp;nbsp;ONE, &amp;nbsp; maybe another dataset &amp;nbsp; )&lt;/P&gt;
&lt;P&gt;end;&lt;BR /&gt;&lt;TT&gt;run;&lt;/TT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is this possible? &amp;nbsp; thx a lot.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2016 23:44:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-call-execute-macro-within-a-DO-loop/m-p/246501#M46130</guid>
      <dc:creator>Laoban_James</dc:creator>
      <dc:date>2016-01-27T23:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: Can I call/execute macro within a DO loop?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-call-execute-macro-within-a-DO-loop/m-p/246502#M46131</link>
      <description>&lt;P&gt;Sort&lt;EM&gt;&lt;U&gt;&lt;/U&gt;&amp;nbsp;&lt;/EM&gt;of, you need to use a routine to call the macro - routine is CALL EXECUTE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Generate the text and pass it to call execute &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2016 23:48:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-call-execute-macro-within-a-DO-loop/m-p/246502#M46131</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-27T23:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: Can I call/execute macro within a DO loop?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-call-execute-macro-within-a-DO-loop/m-p/246559#M46138</link>
      <description>&lt;P&gt;You do not "execute" the macro in the loop. Instead, during the data step compilation phase, the macro is resolved, and the resulting text is inserted as code in the loop, in place of the macro call. Once compilation has finished successfully (meaning the resulting data step code is syntactically correct), the whole code is executed; at data step runtime, no macro elements are therefore present, having been resolved beforehand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you use call execute, be aware that the data step feeds then code into the main SAS interpreter's input queue, and this code is dealt with &lt;U&gt;after&lt;/U&gt; the data step has finished. Also be aware that macro references in a call execute will once again be resolved before the data step starts, unless you prevent that by proper quoting or other means (eg reading macro names from a dataset).&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2016 07:20:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-call-execute-macro-within-a-DO-loop/m-p/246559#M46138</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-01-28T07:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can I call/execute macro within a DO loop?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-call-execute-macro-within-a-DO-loop/m-p/246584#M46154</link>
      <description>&lt;P&gt;What are you trying to do, post test data, in the form of a datastep - and the output you are looking for. &amp;nbsp;The question is too general as it is, yes you could have that macro there, if it generates valid code for its place, yes you could call execute - again if the macro is valid. &amp;nbsp;But we don't know anything around the code, so can't advise.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2016 11:25:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-call-execute-macro-within-a-DO-loop/m-p/246584#M46154</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-01-28T11:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Can I call/execute macro within a DO loop?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-call-execute-macro-within-a-DO-loop/m-p/246592#M46159</link>
      <description>&lt;P&gt;Actually, this question originates from this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/How-to-run-a-rolling-regression-with-two-datasets/m-p/246512/highlight/false#M56241" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/How-to-run-a-rolling-regression-with-two-datasets/m-p/246512/highlight/false#M56241&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Really desparately&amp;nbsp;crasy...&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2016 12:17:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-call-execute-macro-within-a-DO-loop/m-p/246592#M46159</guid>
      <dc:creator>Laoban_James</dc:creator>
      <dc:date>2016-01-28T12:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can I call/execute macro within a DO loop?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-call-execute-macro-within-a-DO-loop/m-p/246609#M46166</link>
      <description>&lt;P&gt;Well, I don't really know what the "regression" part is, am not a statistician, so can't help there. &amp;nbsp;Call execute is used to generate code, it won't speed anything up for you. &amp;nbsp;You will still need to select your data, then run your procedure on it. &amp;nbsp;If it is taking a long time, then consider subsetting, or aggregating your data first. &amp;nbsp;I.e.&lt;/P&gt;
&lt;P&gt;data test_block1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set total (where=(id=1));&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc reg...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test_block2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ...&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Call execute can be used to generate the code per row of your data, but all that means is there will be a vast amount of code all running quickly, rather than a small bit of code running slowly, which will probably end up being more or less the same. &amp;nbsp;SAS procedures and datasteps are optimised, so the more grouping you can do and in the fewer datasteps the better, using datastep rather than SQL might also reduced the resource usage.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2016 13:06:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-call-execute-macro-within-a-DO-loop/m-p/246609#M46166</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-01-28T13:06:15Z</dc:date>
    </item>
  </channel>
</rss>

