<?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: remove short peaks and troughs in time series in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/remove-short-peaks-and-troughs-in-time-series/m-p/355570#M83274</link>
    <description>&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2013/08/28/finite-diff-estimate-maxi.html" target="_blank"&gt;http://blogs.sas.com/content/iml/2013/08/28/finite-diff-estimate-maxi.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 03 May 2017 13:01:21 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2017-05-03T13:01:21Z</dc:date>
    <item>
      <title>remove short peaks and troughs in time series</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-short-peaks-and-troughs-in-time-series/m-p/355500#M83258</link>
      <description>&lt;P&gt;I only have base sas and wonder and have exhaustive daily values for some time series. Just curious, is there an easy way to remove short peaks and throughs. Here shortness is defined by a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;parameter n representing the number of days)?&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 07:24:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-short-peaks-and-troughs-in-time-series/m-p/355500#M83258</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2017-05-03T07:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: remove short peaks and troughs in time series</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-short-peaks-and-troughs-in-time-series/m-p/355501#M83259</link>
      <description>&lt;P&gt;Do you have SAS/Stat or ETS?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can check with the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc setinit;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 07:51:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-short-peaks-and-troughs-in-time-series/m-p/355501#M83259</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-03T07:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: remove short peaks and troughs in time series</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-short-peaks-and-troughs-in-time-series/m-p/355570#M83274</link>
      <description>&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2013/08/28/finite-diff-estimate-maxi.html" target="_blank"&gt;http://blogs.sas.com/content/iml/2013/08/28/finite-diff-estimate-maxi.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 13:01:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-short-peaks-and-troughs-in-time-series/m-p/355570#M83274</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-05-03T13:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: remove short peaks and troughs in time series</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-short-peaks-and-troughs-in-time-series/m-p/355738#M83326</link>
      <description>Thanks. Have SAS/Stat but as I said not ets.</description>
      <pubDate>Wed, 03 May 2017 19:39:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-short-peaks-and-troughs-in-time-series/m-p/355738#M83326</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2017-05-03T19:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: remove short peaks and troughs in time series</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-short-peaks-and-troughs-in-time-series/m-p/355754#M83330</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/99946"&gt;@csetzkorn&lt;/a&gt; wrote:&lt;BR /&gt;Thanks. Have SAS/Stat but as I said not ets.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Your initial posts say Base SAS, nothing about ETS/IML/STAT modules.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One way&amp;nbsp;remove peaks/throughs is a moving average. Determine your cycle length and then apply a moving average.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the moving average calculation you can use a temporary array method illustrated&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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;If you have IML, you have more options but it means doing the math yourself that having the ability to use the predesigned procedures.&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 19:59:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-short-peaks-and-troughs-in-time-series/m-p/355754#M83330</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-03T19:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: remove short peaks and troughs in time series</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-short-peaks-and-troughs-in-time-series/m-p/355823#M83357</link>
      <description>&lt;P&gt;Let's say you have daily data sorted by PERMNO (a stock identifier) and DATE.&amp;nbsp; You want 15-day moving averages of PRICE, but will accept&amp;nbsp;window sizes as small as 10-days:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let winsiz=15;
%let minwin=10;

data want;
  set have;
  by permno;

  if first.permno then do;
    NDays=0;
    sum_price=0;
  end;
  if NDays&amp;lt;&amp;amp;winsiz then NDays+1;

  sum_price + price - ifn(NDays&amp;gt;&amp;amp;winsiz,lag&amp;amp;winsiz(price),0);
  if NDays&amp;gt;=&amp;amp;minwin;
  mean=sum_price/NDays;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2017 01:49:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-short-peaks-and-troughs-in-time-series/m-p/355823#M83357</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-05-04T01:49:02Z</dc:date>
    </item>
  </channel>
</rss>

