<?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: SAS Exponential moving average in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-Exponential-moving-average/m-p/263726#M13912</link>
    <description>I am going through the link. Thanks for your valuable suggestion!!!</description>
    <pubDate>Thu, 14 Apr 2016 02:02:37 GMT</pubDate>
    <dc:creator>lakshmiG</dc:creator>
    <dc:date>2016-04-14T02:02:37Z</dc:date>
    <item>
      <title>SAS Exponential moving average</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-Exponential-moving-average/m-p/263425#M13904</link>
      <description>&lt;P&gt;Please guide me in calculation of SAS Exponential Moving average for N=22 days without using SAS ETS software (Proc expand Procedure)&lt;/P&gt;&lt;P&gt;Please let me know the formula or logic.&lt;/P&gt;&lt;P&gt;As of I browsed, the formula is, EMA =( (close price)-Previous day EMA)*smoothing constant)+Previous day EMA.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, I got some valuable answer from USers of this group.&lt;/P&gt;&lt;P&gt;please see my below code,&lt;/P&gt;&lt;P&gt;data EMA2c(keep=symbol date1 close a22 ema22 lema22 count ma22 );&lt;BR /&gt;set merg;&lt;BR /&gt;by symbol date1;&lt;BR /&gt;retain EMA22;&lt;BR /&gt;if count eq 22 then do;EMA22=ma22;end;&lt;BR /&gt;lema22=lag(ema22);&lt;BR /&gt;/* EMA Calculation */&lt;BR /&gt;if count gt 22 then do;EMA22=((close-lema22)*a22)+lema22;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I code as above, for 23rd and 24th observation, the 22nd EMA value is getting populated(that is lag value of 22nd observation is populated twice),&amp;nbsp; so that other values from 25 are moving down one step though lagging correctly.why this 22nd observation is lagging twice for 23rd and 24th observations? for 23rd observation it can come, for 24th observation,23rd EMA value has to be populated. So confused....&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2016 08:11:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-Exponential-moving-average/m-p/263425#M13904</guid>
      <dc:creator>lakshmiG</dc:creator>
      <dc:date>2016-04-13T08:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Exponential moving average</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-Exponential-moving-average/m-p/263456#M13905</link>
      <description>&lt;P&gt;Where is your data and output ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;&lt;BR /&gt; do stock=1 to 10;&lt;BR /&gt; do date=1 to 100;&lt;BR /&gt; price=ranuni(0)*10;output;&lt;BR /&gt; end;&lt;BR /&gt; end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;%let constant=0.18;&lt;BR /&gt;data want;&lt;BR /&gt; set have;&lt;BR /&gt; by stock;&lt;BR /&gt; if first.stock then do;n=0;ema=.;end;&lt;BR /&gt; n+1;&lt;BR /&gt; &lt;BR /&gt; retain ema;&lt;BR /&gt; if n=22 then ema=price;&lt;BR /&gt; else if n gt 22 then ema= price*&amp;amp;constant + (1-&amp;amp;constant)*ema;&lt;BR /&gt; &lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2016 09:48:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-Exponential-moving-average/m-p/263456#M13905</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-04-13T09:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Exponential moving average</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-Exponential-moving-average/m-p/263457#M13906</link>
      <description>&lt;P&gt;Try the temporary array method?&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/41/380.html" target="_blank"&gt;http://support.sas.com/kb/41/380.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2016 09:52:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-Exponential-moving-average/m-p/263457#M13906</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-04-13T09:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Exponential moving average</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-Exponential-moving-average/m-p/263724#M13911</link>
      <description>((closeprice-emaprevious day)*constant))+emaprevious day, Is this formula right? I will apply and try yours. Thanks for your timely help!!! I am new to this domain. Thanks for your support.</description>
      <pubDate>Thu, 14 Apr 2016 02:01:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-Exponential-moving-average/m-p/263724#M13911</guid>
      <dc:creator>lakshmiG</dc:creator>
      <dc:date>2016-04-14T02:01:01Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Exponential moving average</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-Exponential-moving-average/m-p/263726#M13912</link>
      <description>I am going through the link. Thanks for your valuable suggestion!!!</description>
      <pubDate>Thu, 14 Apr 2016 02:02:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-Exponential-moving-average/m-p/263726#M13912</guid>
      <dc:creator>lakshmiG</dc:creator>
      <dc:date>2016-04-14T02:02:37Z</dc:date>
    </item>
  </channel>
</rss>

