I have a problem that is ostensibly simple, but I'm really struggling with it. In my data I have two columns that are important: END_DATE and DURATION. END_DATE is a date variable formatted as monyy7 (but does contain the day of the month as well). The data looks like this: AUG2015 26 AUG2015 27 AUG2015 16 AUG2015 20 AUG2015 7 AUG2015 22 AUG2015 28 AUG2015 28 AUG2015 35 AUG2015 15 AUG2015 28 AUG2015 8 AUG2015 14 With these I want to calculate a 3 month moving median. It's easy to calculate the median for the months, but I'm not sure how to do a rolling median. From googling I found PROC EXPAND, but this requires non-duplicate variables. This is a problem as for each month we have lots of durations (as you can see from the example). I can't calculate the median for each month and then use PROC EXPAND as a median of a median won't be an accurate measure. I think I need create a new variable where each month is assigned a group but I'm unsure how to do this. ie. AUG2015 =0, SEP2015 =1, OCT2015=2 etc Once I have that I assume that I could calculate the rolling median using some sort of lag function? I'm new to SAS, so apologies if this question is very trivial!
... View more