<?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: How to use a %DO loop to process across all the items in the macro list. in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-a-DO-loop-to-process-across-all-the-items-in-the/m-p/391999#M25283</link>
    <description>&lt;P&gt;Yes, I revised this problem. Thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 30 Aug 2017 19:39:06 GMT</pubDate>
    <dc:creator>zzzyyy</dc:creator>
    <dc:date>2017-08-30T19:39:06Z</dc:date>
    <item>
      <title>How to use a %DO loop to process across all the items in the macro list.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-a-DO-loop-to-process-across-all-the-items-in-the/m-p/391835#M25278</link>
      <description>&lt;P&gt;I have created a macro varible list. But I have problem when I tried to&amp;nbsp;&amp;nbsp;use a %DO loop to process across all the items in the list.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro SalesRpt;
%local r;
proc sql noprint;
 select distinct year
 into :YEAR1 - :YEAR7
 from slm_NAVI_dflt_alL
WHERE YEAR NOT IN (2008,2016,2017);
 quit;
%let YEARCNT = &amp;amp;sqlobs;
%put &amp;amp;YEARCNT;
%do r = 1 %to &amp;amp;YEARCNT;

 PROC SQL;
 CREATE TABLE mir_report AS
		SELECT
			year,sum(act_balance) as sum_act format 13.2, sum(LOAN_DISB_TOT_PRIN_AMT) as sum_disb, 
			calculated sum_act/calculated sum_disb as percent format 13.4 ,mir_pi, count(*) as count
		from performance
		&lt;U&gt;&lt;FONT color="#000000"&gt;where year=&amp;amp;&amp;amp;YEAR&amp;amp;r and 1&amp;lt;=mir_pi&amp;lt;=(2017-&amp;amp;&amp;amp;YEAR&amp;amp;r-1)*12  &lt;/FONT&gt;&lt;/U&gt;
		group by year, mir_pi;
quit;
%end;
%mend salesrpt;
%salerpt&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;The log shows&amp;nbsp;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference YEAR not resolved.&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,&lt;BR /&gt;a missing value, BTRIM, INPUT, PUT, SUBSTRING, USER.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 13:57:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-a-DO-loop-to-process-across-all-the-items-in-the/m-p/391835#M25278</guid>
      <dc:creator>zzzyyy</dc:creator>
      <dc:date>2017-08-30T13:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a %DO loop to process across all the items in the macro list.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-a-DO-loop-to-process-across-all-the-items-in-the/m-p/391841#M25279</link>
      <description>&lt;P&gt;Are you certain that this is the actual code?&amp;nbsp; It doesn't look like this code should cause that error.&amp;nbsp; &amp;amp;&amp;amp;YEAR&amp;amp;r looks like it's correct, although either of these could cause the problem you noted:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;amp;YEAR&amp;amp;R&lt;/P&gt;
&lt;P&gt;&amp;amp;&amp;amp;YEAR.&amp;amp;R&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 14:07:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-a-DO-loop-to-process-across-all-the-items-in-the/m-p/391841#M25279</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-30T14:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a %DO loop to process across all the items in the macro list.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-a-DO-loop-to-process-across-all-the-items-in-the/m-p/391854#M25280</link>
      <description>&lt;P&gt;You may also want to consider modifying this line of code:&lt;/P&gt;
&lt;P&gt;CREATE &lt;SPAN class="token statement"&gt;TABLE&lt;/SPAN&gt; mir_report AS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to something like:&lt;/P&gt;
&lt;P&gt;CREATE &lt;SPAN class="token statement"&gt;TABLE&lt;/SPAN&gt; mir_report&amp;amp;&amp;amp;year&amp;amp;r AS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;otherwise at the end of the loop the only output retained will be for the last year.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 14:24:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-a-DO-loop-to-process-across-all-the-items-in-the/m-p/391854#M25280</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-30T14:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a %DO loop to process across all the items in the macro list.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-a-DO-loop-to-process-across-all-the-items-in-the/m-p/391862#M25281</link>
      <description>&lt;P&gt;Use MPRINT and SYMBOLGEN and post your full log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 14:38:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-a-DO-loop-to-process-across-all-the-items-in-the/m-p/391862#M25281</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-30T14:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a %DO loop to process across all the items in the macro list.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-a-DO-loop-to-process-across-all-the-items-in-the/m-p/391996#M25282</link>
      <description>&lt;P&gt;I just figure out that the code is correct, except the last line... I called the wrong name.... Should be %salesrpt instead of %salerpt...&lt;/P&gt;&lt;P&gt;Thanks to everyone for your help&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://communities.sas.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 19:37:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-a-DO-loop-to-process-across-all-the-items-in-the/m-p/391996#M25282</guid>
      <dc:creator>zzzyyy</dc:creator>
      <dc:date>2017-08-30T19:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a %DO loop to process across all the items in the macro list.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-a-DO-loop-to-process-across-all-the-items-in-the/m-p/391999#M25283</link>
      <description>&lt;P&gt;Yes, I revised this problem. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 19:39:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-a-DO-loop-to-process-across-all-the-items-in-the/m-p/391999#M25283</guid>
      <dc:creator>zzzyyy</dc:creator>
      <dc:date>2017-08-30T19:39:06Z</dc:date>
    </item>
  </channel>
</rss>

