<?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: computing a rolling centereed median in SAS Forecasting and Econometrics</title>
    <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/computing-a-rolling-centereed-median/m-p/457800#M3102</link>
    <description>Thanks! looks great!</description>
    <pubDate>Thu, 26 Apr 2018 15:58:33 GMT</pubDate>
    <dc:creator>NewSASuser2018</dc:creator>
    <dc:date>2018-04-26T15:58:33Z</dc:date>
    <item>
      <title>computing a rolling centereed median</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/computing-a-rolling-centereed-median/m-p/457372#M3096</link>
      <description>&lt;P&gt;Hello sas community!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My issue is the following. I have a large dataset containing ultra high frequency data (tick data), which I want to filter for outliers as suggested in the literature:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;Time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RateBid&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RateAsk .....&lt;/DIV&gt;&lt;DIV&gt;01.01.2015:17:12:12.445&amp;nbsp;&amp;nbsp; xxxxxxxxxx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xxxxxxxxx&lt;BR /&gt;01.01.2015:17:13:32.565&amp;nbsp;&amp;nbsp; xxxxxxxxxx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xxxxxxxxx&lt;BR /&gt;01.01.2015:17:13:40.685&amp;nbsp;&amp;nbsp; xxxxxxxxxx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xxxxxxxxx&lt;BR /&gt;01.01.2015:17:14:59.895&amp;nbsp;&amp;nbsp; 1.32473 &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 1.32487&lt;BR /&gt;01.01.2015:17:14:59.995 &amp;nbsp; 1.86743 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.97473&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An example.csv is attached below. I have already removed many obvious data anomalies and now want to filter for outliers as suggested in the literature (e.g. Barndorff-Nielsen Hansen Lunde Shephard (2009) if any of you are interested).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My specific issue is:&lt;/P&gt;&lt;P&gt;I want to delete all entries for which the so called mid-quote ((RateBid+RateAsk)/2) deviated by more than 10 mean absolute deviations from a rolling centered median (excluding the observation under consideration) of the 50 observations around the one considered (so 25 before and 25 after).&amp;nbsp; Here to be honest, I cannot figure out how to construct such a measure in sas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To clarify, I need to compute a "rolling" median - let's call it M - that goes through the sample step by step and is constructed such that:&lt;/P&gt;&lt;P&gt;for given observations e.g. t1, t2,....,t25, tk ,tk+1,...,tk+25 ,&amp;nbsp; for observation tk the median is only computed of the values (t1-t25 and tk+1 to tk+25). And this has to run through all the observations in the sample. This is to ensure that unusual outliers, that are not in line with surrounding observations are removed, without removing any that might be e.g. the first after a discrete jump.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope you can help me with my issue. Thank you very much in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 15:52:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/computing-a-rolling-centereed-median/m-p/457372#M3096</guid>
      <dc:creator>NewSASuser2018</dc:creator>
      <dc:date>2018-04-25T15:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: computing a rolling centereed median</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/computing-a-rolling-centereed-median/m-p/457482#M3097</link>
      <description>Do you have SAS/ETS? If so, PROC EXPAND s what you're looking for and look at the CONVERT example in the documentation. If you don't you have other options, but this is the first approach I'd take. You may have to construct a different TimeID since you're looking at the nearest 50 trades regardless of date/time difference. &lt;BR /&gt;</description>
      <pubDate>Wed, 25 Apr 2018 19:40:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/computing-a-rolling-centereed-median/m-p/457482#M3097</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-25T19:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: computing a rolling centereed median</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/computing-a-rolling-centereed-median/m-p/457548#M3098</link>
      <description>I work with sas 9.4 as far as I remember, if that is what you are asking. Your idea looks at if it is what I am looking for. Regarding the TimeID you are right, my raw data time stamps are not equidistant. What kind of timeID would you suggest instead?&lt;BR /&gt;&lt;BR /&gt;Thank you very much!</description>
      <pubDate>Wed, 25 Apr 2018 22:14:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/computing-a-rolling-centereed-median/m-p/457548#M3098</guid>
      <dc:creator>NewSASuser2018</dc:creator>
      <dc:date>2018-04-25T22:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: computing a rolling centereed median</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/computing-a-rolling-centereed-median/m-p/457561#M3099</link>
      <description>&lt;P&gt;Run the following and&amp;nbsp;check if the log includes ETS&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc product_status;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Mine shows:&lt;/P&gt;
&lt;P&gt;For SAS/ETS ...&lt;BR /&gt; Custom version information: 14.1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 22:44:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/computing-a-rolling-centereed-median/m-p/457561#M3099</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-25T22:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: computing a rolling centereed median</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/computing-a-rolling-centereed-median/m-p/457619#M3100</link>
      <description>I get the same.&lt;BR /&gt;For SAS/ETS ...&lt;BR /&gt;Custom version information: 14.3&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Apr 2018 07:41:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/computing-a-rolling-centereed-median/m-p/457619#M3100</guid>
      <dc:creator>NewSASuser2018</dc:creator>
      <dc:date>2018-04-26T07:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: computing a rolling centereed median</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/computing-a-rolling-centereed-median/m-p/457774#M3101</link>
      <description>&lt;P&gt;You're probably looking for something along these lines:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ibm;
set sashelp.stocks;
where stock='IBM';
fake_date = _n_;
run;

proc expand data=ibm out=want;
id fake_date;
convert open = median_open / transformout=( cmovmed 51 trimleft 25);
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Apr 2018 14:52:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/computing-a-rolling-centereed-median/m-p/457774#M3101</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-26T14:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: computing a rolling centereed median</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/computing-a-rolling-centereed-median/m-p/457800#M3102</link>
      <description>Thanks! looks great!</description>
      <pubDate>Thu, 26 Apr 2018 15:58:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/computing-a-rolling-centereed-median/m-p/457800#M3102</guid>
      <dc:creator>NewSASuser2018</dc:creator>
      <dc:date>2018-04-26T15:58:33Z</dc:date>
    </item>
  </channel>
</rss>

