<?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: Iteration interval of BY-clause in DO-LOOP in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Iteration-interval-of-BY-clause-in-DO-LOOP/m-p/615032#M179856</link>
    <description>&lt;P&gt;The normal DO loop does not have all of functionality of the AXIS statements. (just like the macro %DO loop does not have all of the functionality of the data step DO loop).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could just look over the offset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data  _null_;
  do k= -13 to -1 ;
    date=intnx('month',today(),k,'END') ;
    put k= date= date9.;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or add code to increment the variable and use WHILE or UNTIL to end the loop.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data  _null_;
  date=intnx('month',today(),-13,'END');
  do until (date &amp;gt;= today());
    put date= date9.;
    date=intnx('month',date,1,'END') ;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jan 2020 18:55:28 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-01-03T18:55:28Z</dc:date>
    <item>
      <title>Iteration interval of BY-clause in DO-LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Iteration-interval-of-BY-clause-in-DO-LOOP/m-p/614985#M179831</link>
      <description>&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when using the GPLOT-Procedure, I can give a keyword like "YEAR" in order to have the axis values to loop on a yearly interval. Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC GPLOT DATA=book.graph1;
PLOT fund*date / VREF=5000 LV=1 CV=blue
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;HAXIS='01SEP1975'd TO '01SEP2015'd by YEAR&lt;/STRONG&gt;&lt;/FONT&gt;;
FORMAT date mmddyy10.;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now, I was wondering: does this functionality not also work with DO-LOOPs:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _NULL_;

do k= intnx('month',today(),-13,'END') TO intnx('month',today(),-1,'END') &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;by MONTH&lt;/STRONG&gt;&lt;/FONT&gt; ;
put k=;
format k date9.;
end;

run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I get an Error message, however.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is my syntax wrong, or does this functionality just not exist in the context of Loops?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I would like to see in the Log is this:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;k=31DEC2018&lt;BR /&gt;k=31JAN2019&lt;/P&gt;&lt;P&gt;k=28FEB2019&lt;BR /&gt;k=31MAR2019&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;FK&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2020 15:48:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Iteration-interval-of-BY-clause-in-DO-LOOP/m-p/614985#M179831</guid>
      <dc:creator>FK1</dc:creator>
      <dc:date>2020-01-03T15:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Iteration interval of BY-clause in DO-LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Iteration-interval-of-BY-clause-in-DO-LOOP/m-p/614989#M179834</link>
      <description>&lt;P&gt;The BY specification (BY MONTH, or BY YEAR) is special syntax reserved for graphics procedures.&amp;nbsp; However, you should be able to mimic that using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _NULL_;

do m = -13 to -1;
   k= intnx('month',today(), m,'END');
   put k=;
   format k date9.;
end;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Jan 2020 15:52:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Iteration-interval-of-BY-clause-in-DO-LOOP/m-p/614989#M179834</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2020-01-03T15:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: Iteration interval of BY-clause in DO-LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Iteration-interval-of-BY-clause-in-DO-LOOP/m-p/615032#M179856</link>
      <description>&lt;P&gt;The normal DO loop does not have all of functionality of the AXIS statements. (just like the macro %DO loop does not have all of the functionality of the data step DO loop).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could just look over the offset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data  _null_;
  do k= -13 to -1 ;
    date=intnx('month',today(),k,'END') ;
    put k= date= date9.;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or add code to increment the variable and use WHILE or UNTIL to end the loop.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data  _null_;
  date=intnx('month',today(),-13,'END');
  do until (date &amp;gt;= today());
    put date= date9.;
    date=intnx('month',date,1,'END') ;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2020 18:55:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Iteration-interval-of-BY-clause-in-DO-LOOP/m-p/615032#M179856</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-03T18:55:28Z</dc:date>
    </item>
  </channel>
</rss>

