<?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: computation of rolling average in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/computation-of-rolling-average/m-p/592567#M15375</link>
    <description>&lt;P&gt;Simply change the function &lt;STRONG&gt;std &lt;/STRONG&gt;to &lt;STRONG&gt;mean&amp;nbsp;&lt;/STRONG&gt;like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   create table want as
   select *, 
          (select mean(sales) from have 
             where Company_Name=a.Company_Name
               and a.year-5 le year le a.year)
                 as MovAv format=8.2
   from have as a;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 30 Sep 2019 08:29:28 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-09-30T08:29:28Z</dc:date>
    <item>
      <title>computation of rolling average</title>
      <link>https://communities.sas.com/t5/New-SAS-User/computation-of-rolling-average/m-p/592562#M15374</link>
      <description>&lt;P&gt;dear all&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have to compute average of a variable in panel data set on rolling basis.&lt;/P&gt;&lt;P&gt;Earlier, i used the following commond to compute rolling standard deviation as suggested by the members in this community and it worked well.&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;roc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
   create &lt;SPAN class="token statement"&gt;table&lt;/SPAN&gt; want as
   &lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; 
          &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;std&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;sales&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt; have 
             &lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; Company_Name&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;a&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;Company_Name
               and a&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;year&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;-5&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;le&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;year&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;le&lt;/SPAN&gt; a&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;year&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;
                 as stddev &lt;SPAN class="token procnames"&gt;format&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;8.2&lt;/SPAN&gt;
   &lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt; have as a&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;please let me know, what changes i have to do to compute rolling average for the same dataset.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 05:14:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/computation-of-rolling-average/m-p/592562#M15374</guid>
      <dc:creator>srikanthyadav44</dc:creator>
      <dc:date>2019-09-30T05:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: computation of rolling average</title>
      <link>https://communities.sas.com/t5/New-SAS-User/computation-of-rolling-average/m-p/592567#M15375</link>
      <description>&lt;P&gt;Simply change the function &lt;STRONG&gt;std &lt;/STRONG&gt;to &lt;STRONG&gt;mean&amp;nbsp;&lt;/STRONG&gt;like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   create table want as
   select *, 
          (select mean(sales) from have 
             where Company_Name=a.Company_Name
               and a.year-5 le year le a.year)
                 as MovAv format=8.2
   from have as a;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Sep 2019 08:29:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/computation-of-rolling-average/m-p/592567#M15375</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-30T08:29:28Z</dc:date>
    </item>
  </channel>
</rss>

