<?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: calculation of first 1 day  last 7 days and 15 days average in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/calculation-of-first-1-day-last-7-days-and-15-days-average/m-p/457180#M115892</link>
    <description>&lt;P&gt;Post test data in the form of a datastep, and what you want the output to look like.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table want as 
  select "1 day" as cat,&lt;BR /&gt;         a.*,&lt;BR /&gt;         b.res&lt;BR /&gt;  from   have a &lt;BR /&gt;  left join (select account,sum(amount) as res from have where a.date -1 &amp;lt;= date &amp;lt;= a.date) b&lt;BR /&gt;  on     a.account=b.account;&lt;BR /&gt;quit;&lt;/PRE&gt;
&lt;P&gt;Shows one way which may work to get the 1 day, same thing for 7 and 15.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Apr 2018 08:29:46 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-04-25T08:29:46Z</dc:date>
    <item>
      <title>calculation of first 1 day  last 7 days and 15 days average</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-of-first-1-day-last-7-days-and-15-days-average/m-p/457160#M115884</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Need your help in calculating the average of 1 day, last 7 days and Last 15 days. I have the transaction amount by&amp;nbsp;date and Account number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm attaching the data for your reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks for the help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Kumar&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 06:11:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-of-first-1-day-last-7-days-and-15-days-average/m-p/457160#M115884</guid>
      <dc:creator>anilgvdbm</dc:creator>
      <dc:date>2018-04-25T06:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: calculation of first 1 day  last 7 days and 15 days average</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-of-first-1-day-last-7-days-and-15-days-average/m-p/457180#M115892</link>
      <description>&lt;P&gt;Post test data in the form of a datastep, and what you want the output to look like.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table want as 
  select "1 day" as cat,&lt;BR /&gt;         a.*,&lt;BR /&gt;         b.res&lt;BR /&gt;  from   have a &lt;BR /&gt;  left join (select account,sum(amount) as res from have where a.date -1 &amp;lt;= date &amp;lt;= a.date) b&lt;BR /&gt;  on     a.account=b.account;&lt;BR /&gt;quit;&lt;/PRE&gt;
&lt;P&gt;Shows one way which may work to get the 1 day, same thing for 7 and 15.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 08:29:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-of-first-1-day-last-7-days-and-15-days-average/m-p/457180#M115892</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-25T08:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: calculation of first 1 day  last 7 days and 15 days average</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-of-first-1-day-last-7-days-and-15-days-average/m-p/457249#M115908</link>
      <description>&lt;P&gt;If you post example data in a csv, you should also post the code you use to read that data into a SAS dataset. Only then can we recreate your dataset exactly as it is.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 12:30:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-of-first-1-day-last-7-days-and-15-days-average/m-p/457249#M115908</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-25T12:30:33Z</dc:date>
    </item>
  </channel>
</rss>

