BookmarkSubscribeRSS Feed
Jordana_Anthem
Fluorite | Level 6

Good afternoon,

 

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.

 

Kind Thanks,

Jordana

4 REPLIES 4
Reeza
Super User

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.

Jordana_Anthem
Fluorite | Level 6

Hi Reeza,

 

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.

 

Kind thanks,

Jordana

Reeza
Super User

Sorry, here it is:

 

https://gist.github.com/statgeek/27e23c015eae7953eff2

 

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.

 

Jordana_Anthem
Fluorite | Level 6

Thanks for your assistance.  I was able to find another solution that worked. 

 

Best,

 

Jordana

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1094 views
  • 0 likes
  • 2 in conversation