<?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: %DO statement is not valid in open code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/DO-statement-is-not-valid-in-open-code/m-p/52152#M10999</link>
    <description>Not that it particularly matters, but....&lt;BR /&gt;
&lt;BR /&gt;
[pre]%do increm=1 %to &amp;amp;calendar_mn %do;[/pre]&lt;BR /&gt;
&lt;BR /&gt;
I suspect that the second, extra, %DO is masked during macro compilation by the first %DO statement, and then exposed during macro execution - thus the 'in open code error'.  Although I am surprised that there was not an error during the macro compilation of the iterative %DO statement.</description>
    <pubDate>Sun, 19 Dec 2010 22:37:19 GMT</pubDate>
    <dc:creator>ArtC</dc:creator>
    <dc:date>2010-12-19T22:37:19Z</dc:date>
    <item>
      <title>%DO statement is not valid in open code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-statement-is-not-valid-in-open-code/m-p/52148#M10995</link>
      <description>Good morning,&lt;BR /&gt;
&lt;BR /&gt;
Here is the macro variables I created but I got error message and I am not sure why?  Could you please help?  Thank you! Y&lt;BR /&gt;
&lt;BR /&gt;
ERROR: The %DO statement is not valid in open code.&lt;BR /&gt;
&lt;BR /&gt;
[/prep]&lt;BR /&gt;
 %let org_date = "16Dec2009"d;&lt;BR /&gt;
 %let calendar_mn  = 3;&lt;BR /&gt;
&lt;BR /&gt;
 %macro get_all;&lt;BR /&gt;
     %do increm=1 %to &amp;amp;calendar_mn %do;&lt;BR /&gt;
      data cal_date;&lt;BR /&gt;
        decrem=&amp;amp;increm-1;&lt;BR /&gt;
&lt;BR /&gt;
        if decrem=0 then beg_date = &amp;amp;org_date;		&lt;BR /&gt;
        else  beg_date = intnx('month', &amp;amp;org_date, decrem );&lt;BR /&gt;
        end_date = intnx('month', &amp;amp;org_date, &amp;amp;increm );&lt;BR /&gt;
&lt;BR /&gt;
        call symput("beg_date", compress(put(beg_date, 11.)));&lt;BR /&gt;
        call symput("end_date", compress(put(end_date, 11.)));&lt;BR /&gt;
     run;&lt;BR /&gt;
&lt;BR /&gt;
     %end;&lt;BR /&gt;
 %mend get_all;&lt;BR /&gt;
&lt;BR /&gt;
 %get_all&lt;BR /&gt;
&lt;BR /&gt;
[/prep]</description>
      <pubDate>Sun, 19 Dec 2010 15:37:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-statement-is-not-valid-in-open-code/m-p/52148#M10995</guid>
      <dc:creator>Ying</dc:creator>
      <dc:date>2010-12-19T15:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: %DO statement is not valid in open code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-statement-is-not-valid-in-open-code/m-p/52149#M10996</link>
      <description>Ying,&lt;BR /&gt;
&lt;BR /&gt;
Not sure why you would get that particular error message, but you have an extra %do.&lt;BR /&gt;
&lt;BR /&gt;
That is, you have:&lt;BR /&gt;
&lt;BR /&gt;
%do increm=1 %to &amp;amp;calendar_mn %do;&lt;BR /&gt;
&lt;BR /&gt;
but should only have had:&lt;BR /&gt;
&lt;BR /&gt;
%do increm=1 %to &amp;amp;calendar_mn;&lt;BR /&gt;
&lt;BR /&gt;
HTH,&lt;BR /&gt;
Art</description>
      <pubDate>Sun, 19 Dec 2010 15:48:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-statement-is-not-valid-in-open-code/m-p/52149#M10996</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2010-12-19T15:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: %DO statement is not valid in open code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-statement-is-not-valid-in-open-code/m-p/52150#M10997</link>
      <description>Suggest pasting your SAS-generated log as you see it into a post-repy here, rather than just your SAS code.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Sun, 19 Dec 2010 17:05:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-statement-is-not-valid-in-open-code/m-p/52150#M10997</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-12-19T17:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: %DO statement is not valid in open code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-statement-is-not-valid-in-open-code/m-p/52151#M10998</link>
      <description>Thank you so much, art297!  The ERROR's gone!</description>
      <pubDate>Sun, 19 Dec 2010 18:20:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-statement-is-not-valid-in-open-code/m-p/52151#M10998</guid>
      <dc:creator>Ying</dc:creator>
      <dc:date>2010-12-19T18:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: %DO statement is not valid in open code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-statement-is-not-valid-in-open-code/m-p/52152#M10999</link>
      <description>Not that it particularly matters, but....&lt;BR /&gt;
&lt;BR /&gt;
[pre]%do increm=1 %to &amp;amp;calendar_mn %do;[/pre]&lt;BR /&gt;
&lt;BR /&gt;
I suspect that the second, extra, %DO is masked during macro compilation by the first %DO statement, and then exposed during macro execution - thus the 'in open code error'.  Although I am surprised that there was not an error during the macro compilation of the iterative %DO statement.</description>
      <pubDate>Sun, 19 Dec 2010 22:37:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-statement-is-not-valid-in-open-code/m-p/52152#M10999</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2010-12-19T22:37:19Z</dc:date>
    </item>
  </channel>
</rss>

