<?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: Rolling Dates in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Rolling-Dates/m-p/684#M186</link>
    <description>Magnus,&lt;BR /&gt;
&lt;BR /&gt;
This is pure Base SAS, not EG, so it will have to be pasted into a Code window (although it could also be constructed in a Query task), but I think it solves your problem:&lt;BR /&gt;
&lt;BR /&gt;
data example;&lt;BR /&gt;
  informat payments best.&lt;BR /&gt;
           date mmddyy8.&lt;BR /&gt;
           ;&lt;BR /&gt;
  format date date9.;&lt;BR /&gt;
  input payments date;&lt;BR /&gt;
  datalines;&lt;BR /&gt;
1200 5/5/05&lt;BR /&gt;
1000 4/1/06&lt;BR /&gt;
500 1/3/06&lt;BR /&gt;
150 6/7/06&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  create table rolling as&lt;BR /&gt;
    select a.date&lt;BR /&gt;
          ,sum(b.payments) as rolling_total&lt;BR /&gt;
    from   example a&lt;BR /&gt;
          ,example b&lt;BR /&gt;
    where  b.date between a.date and mdy(month(a.date),day(a.date),year(a.date)-1)+1&lt;BR /&gt;
    group by&lt;BR /&gt;
           a.date&lt;BR /&gt;
  ;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
.........Phil</description>
    <pubDate>Tue, 04 Jul 2006 11:05:38 GMT</pubDate>
    <dc:creator>prholland</dc:creator>
    <dc:date>2006-07-04T11:05:38Z</dc:date>
    <item>
      <title>Rolling Dates</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Rolling-Dates/m-p/682#M184</link>
      <description>I have a question regarding Rolling dates.&lt;BR /&gt;
&lt;BR /&gt;
I have a column of payments and another one with dates associated with the payment.&lt;BR /&gt;
&lt;BR /&gt;
&lt;U&gt;example[/u&lt;BR /&gt;
&lt;B&gt;payments              date&lt;/B&gt;&lt;BR /&gt;
1200                  5/5/05&lt;BR /&gt;
1000                  4/1/06&lt;BR /&gt;
500                   1/3/06&lt;BR /&gt;
&lt;BR /&gt;
How do I calculate the rolling 12 months?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: Magnus at May 24, 2006 2:23 PM

&lt;BR /&gt;
Message was edited by: Magnus at May 24, 2006 2:26 PM&lt;BR /&gt;&lt;/U&gt;</description>
      <pubDate>Mon, 22 May 2006 20:02:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Rolling-Dates/m-p/682#M184</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-05-22T20:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling Dates</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Rolling-Dates/m-p/683#M185</link>
      <description>Hi Magnus,&lt;BR /&gt;
&lt;BR /&gt;
I'm not sure if this is specifically an Enterprise Guide question or not (I'm new to EG but am long-in-the-tooth on SAS).&lt;BR /&gt;
&lt;BR /&gt;
Unless this is already solved, you may need to clarify it a little. For example you refer to two columns of dates but in your example I can only see one column.&lt;BR /&gt;
&lt;BR /&gt;
Given a date eg 05May2006, what do you mean by "the rolling 12 months", do you mean 04May2007 or something more tricky, also, are you solely an EG point'n'click user or are you happy about writing a little datastep code?&lt;BR /&gt;
&lt;BR /&gt;
Please let us know.&lt;BR /&gt;
&lt;BR /&gt;
Cheers.</description>
      <pubDate>Mon, 12 Jun 2006 04:07:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Rolling-Dates/m-p/683#M185</guid>
      <dc:creator>DaveShea</dc:creator>
      <dc:date>2006-06-12T04:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling Dates</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Rolling-Dates/m-p/684#M186</link>
      <description>Magnus,&lt;BR /&gt;
&lt;BR /&gt;
This is pure Base SAS, not EG, so it will have to be pasted into a Code window (although it could also be constructed in a Query task), but I think it solves your problem:&lt;BR /&gt;
&lt;BR /&gt;
data example;&lt;BR /&gt;
  informat payments best.&lt;BR /&gt;
           date mmddyy8.&lt;BR /&gt;
           ;&lt;BR /&gt;
  format date date9.;&lt;BR /&gt;
  input payments date;&lt;BR /&gt;
  datalines;&lt;BR /&gt;
1200 5/5/05&lt;BR /&gt;
1000 4/1/06&lt;BR /&gt;
500 1/3/06&lt;BR /&gt;
150 6/7/06&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  create table rolling as&lt;BR /&gt;
    select a.date&lt;BR /&gt;
          ,sum(b.payments) as rolling_total&lt;BR /&gt;
    from   example a&lt;BR /&gt;
          ,example b&lt;BR /&gt;
    where  b.date between a.date and mdy(month(a.date),day(a.date),year(a.date)-1)+1&lt;BR /&gt;
    group by&lt;BR /&gt;
           a.date&lt;BR /&gt;
  ;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
.........Phil</description>
      <pubDate>Tue, 04 Jul 2006 11:05:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Rolling-Dates/m-p/684#M186</guid>
      <dc:creator>prholland</dc:creator>
      <dc:date>2006-07-04T11:05:38Z</dc:date>
    </item>
  </channel>
</rss>

