<?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: EWMA using data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/EWMA-using-data-step/m-p/345667#M273153</link>
    <description>&lt;P&gt;Look this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2016/01/27/moving-average-in-sas.html" target="_blank"&gt;http://blogs.sas.com/content/iml/2016/01/27/moving-average-in-sas.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Mar 2017 07:36:49 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2017-03-30T07:36:49Z</dc:date>
    <item>
      <title>EWMA using data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/EWMA-using-data-step/m-p/345524#M273151</link>
      <description>&lt;P&gt;Hello;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since I do not have ETS package licensed, I am trying to use data step in sas to calculate EWMA (Exponential Weighted Moving Average).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me give you an example of what I need to calculate EWMA. Assume I have the following dataset:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/8025i4ECFCB0C7BDD73B5/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to add two columns named "smoothed" and "forecasted". the first element of the forcasted column is average of the "ILI_Percent", so we have:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/8026i4F1EC1C9CF0B08AC/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the smoothed value of each row is going to be : &amp;nbsp;0.5 * ILI_Percent [i] + 0.5 * forecasted[i]&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the next value of the forecasted column is equal to the prevouis value of smoothed column: smoothed[i]=forecasted[i+1]&lt;/P&gt;&lt;P&gt;so we are going to have:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/8027i13E90A758AB89298/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to do the same thing in data step, but I am not sure how can I reach to previous element of a column in data step. I would be appriciate if someone help me with this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 19:59:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/EWMA-using-data-step/m-p/345524#M273151</guid>
      <dc:creator>samira</dc:creator>
      <dc:date>2017-03-29T19:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: EWMA using data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/EWMA-using-data-step/m-p/345560#M273152</link>
      <description>&lt;P&gt;If it's something you calculate, use a retain statement to hold the value in a variable. If it is a value that is already in the dataset, use the lag function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 22:05:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/EWMA-using-data-step/m-p/345560#M273152</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-29T22:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: EWMA using data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/EWMA-using-data-step/m-p/345667#M273153</link>
      <description>&lt;P&gt;Look this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2016/01/27/moving-average-in-sas.html" target="_blank"&gt;http://blogs.sas.com/content/iml/2016/01/27/moving-average-in-sas.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2017 07:36:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/EWMA-using-data-step/m-p/345667#M273153</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-03-30T07:36:49Z</dc:date>
    </item>
  </channel>
</rss>

