<?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: create a range of date in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/create-a-range-of-date/m-p/552243#M74598</link>
    <description>&lt;P&gt;Your example data implies that you want the beginning of the month for two months prior and two months after the date. If that is the complete rule then this does that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   format newcaldt date9.;
   do i=-2 to 2;
      newcaldt= intnx('month',caldt,i,'B');
      output;
   end;
   drop i;
run;&lt;/PRE&gt;
&lt;P&gt;I left in the original date variable so you could verify what is going on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Apr 2019 18:33:03 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-04-18T18:33:03Z</dc:date>
    <item>
      <title>create a range of date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/create-a-range-of-date/m-p/552231#M74596</link>
      <description>&lt;P&gt;I want to create a table that create a window of date from in initial date by moving forwad and retreat by month&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the following data&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data HAVE;&lt;BR /&gt;input id :best32. caldt :mmddyy10. ;&lt;BR /&gt;format caldt date9.;&lt;BR /&gt;datalines;&lt;BR /&gt;1 1/1/2013 &lt;BR /&gt;2 2/1/2014&lt;/P&gt;
&lt;P&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data want;&lt;BR /&gt;input id :best32. newcaldt :mmddyy10. ;&lt;BR /&gt;format newcaldt date9.;&lt;BR /&gt;datalines;&lt;BR /&gt;1 11/1/2012 &lt;BR /&gt;1 12/1/2012 &lt;BR /&gt;1 1/1/2013 &lt;BR /&gt;1 2/1/2013 &lt;BR /&gt;1 3/1/2013 &lt;BR /&gt;2 11/1/2013 &lt;BR /&gt;2 12/1/2013 &lt;BR /&gt;2 2/1/2014 &lt;BR /&gt;2 3/1/2014 &lt;BR /&gt;2 4/1/2014&lt;/P&gt;
&lt;P&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2019 18:11:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/create-a-range-of-date/m-p/552231#M74596</guid>
      <dc:creator>sasphd</dc:creator>
      <dc:date>2019-04-18T18:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: create a range of date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/create-a-range-of-date/m-p/552242#M74597</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
	do month=-2 to 2 by 1;
	    newcaldate=intnx('month',caldt,month,'b');
		output;
	end;
	format newcaldate mmddyy10.;
	drop month caldt;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;By the way, I think you typed the dates in the want data set incorrectly, if I am understanding the problem correctly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2019 18:33:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/create-a-range-of-date/m-p/552242#M74597</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-18T18:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: create a range of date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/create-a-range-of-date/m-p/552243#M74598</link>
      <description>&lt;P&gt;Your example data implies that you want the beginning of the month for two months prior and two months after the date. If that is the complete rule then this does that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   format newcaldt date9.;
   do i=-2 to 2;
      newcaldt= intnx('month',caldt,i,'B');
      output;
   end;
   drop i;
run;&lt;/PRE&gt;
&lt;P&gt;I left in the original date variable so you could verify what is going on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2019 18:33:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/create-a-range-of-date/m-p/552243#M74598</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-18T18:33:03Z</dc:date>
    </item>
  </channel>
</rss>

