Hello sas community! 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: Time RateBid RateAsk ..... 01.01.2015:17:12:12.445 xxxxxxxxxx xxxxxxxxx 01.01.2015:17:13:32.565 xxxxxxxxxx xxxxxxxxx 01.01.2015:17:13:40.685 xxxxxxxxxx xxxxxxxxx 01.01.2015:17:14:59.895 1.32473 1.32487 01.01.2015:17:14:59.995 1.86743 1.97473 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). My specific issue is: 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). Here to be honest, I cannot figure out how to construct such a measure in sas. 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: for given observations e.g. t1, t2,....,t25, tk ,tk+1,...,tk+25 , 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. I hope you can help me with my issue. Thank you very much in advance! Kind regards
... View more