05-13-2015 05:53 AM
Thanks for your reply.
The link which you shared is to calculate moving average and I have already gone through it..
But I am looking for a code to calculate Moving "MEDIAN" for last 30 days.
05-13-2015 06:00 AM
Ah. maybe have a look at the expand procedure then:
(Replace MOVAVE with the MOVMED)
05-13-2015 06:07 AM
Have gone to that option as well, and sorry to not mention that in my first post.
The challenge is we don't have SAS ETS with us, thus I need a code which should work in Base SAS.
05-14-2015 08:31 AM
OK. Here is an example :
data have; do date='01jan2014'd to today(); v=ranuni(1234); output; end; format date date9.; run; proc sql; create table want as select *,(select median(v) from have where date between a.date-30 and a.date) as moving_median_30_day from have as a; quit;