<?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: Loop to create number sequence and date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Loop-to-create-number-sequence-and-date/m-p/368163#M275435</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mdm;
new='31Jan2015'd;
do i=232 to 280 by 1;
j=i-232;
output;
new=intnx('month',new,1+j,'e');
end;
format new date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 19 Jun 2017 05:59:13 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2017-06-19T05:59:13Z</dc:date>
    <item>
      <title>Loop to create number sequence and date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-to-create-number-sequence-and-date/m-p/368155#M275434</link>
      <description>&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; mdm;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; i=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;232&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;to&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;280&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;output&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dt &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;mmddyy10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;The above datastep creates a number sequence starting at 232 and ending at 280&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;The dataset I am working defines a date based on the number in month sequence.&amp;nbsp; For example&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;232 represents 01/31/15, 233 represents 02/28/15 etc.... i represents the numberic sequence.&amp;nbsp; How can I add a date sequence starting at 232 and a variable say dt and have it mirror the number sequence?&amp;nbsp; Also as you can see the number ends at 280, how can I set it up to continue for future months,&amp;nbsp; say 232 to the previous month even when the previous month becomes greater than 280???&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 05:04:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-to-create-number-sequence-and-date/m-p/368155#M275434</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2017-06-19T05:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: Loop to create number sequence and date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-to-create-number-sequence-and-date/m-p/368163#M275435</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mdm;
new='31Jan2015'd;
do i=232 to 280 by 1;
j=i-232;
output;
new=intnx('month',new,1+j,'e');
end;
format new date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Jun 2017 05:59:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-to-create-number-sequence-and-date/m-p/368163#M275435</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-06-19T05:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Loop to create number sequence and date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-to-create-number-sequence-and-date/m-p/368251#M275436</link>
      <description>&lt;P&gt;Here's a variation on the theme:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;do i=232 to 280;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;date = intnx('month', '31jan2015'd, i - 232, 'e');&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;output;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;drop i;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your second question, you'll have to give an example of what "the previous month" means. I'm sure it's possible, but I'm not sure what needs to happen.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 11:56:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-to-create-number-sequence-and-date/m-p/368251#M275436</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-06-19T11:56:51Z</dc:date>
    </item>
  </channel>
</rss>

