06-27-2017 01:32 PM
I need to calculate a number of events (sum) within rolling 12 month periods. The date format is 'DDMMMYYYY' with a 2 year (24 month) range, and I need to report this at person level. I haven't developed any code yet. I am using SAS EG and would like some guidance at your earliest convenience please.
06-27-2017 02:36 PM
Do you have a license for SAS/ETS?
If so, look at PROC EXPAND, the third example in the documentation shows how to calculate rolling stats.
Otherwise, there are many ways...a temporary array is a common method:
Here's an example for a moving window of 4 and min/max. You can replace that with SUM/MEAN or whatever rolling stats you're interested in.
06-27-2017 02:44 PM
Thanks for your response. I only have access to SAS EG. Is there an example that was attached with your reply, if so, it didn't come across. I am ready to try a solution any time.
06-27-2017 02:49 PM
Sorry, here it is:
ETS is a module, you may still have it in EG.
It's under Tasks>Time Series>Prepare Time Series Data
On the left hand menu there's something called transformations that will allow you to create rolling/moving stats.