BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
claireluen
Calcite | Level 5

I am working on a forecasting project where I am calculating moving averages.  I would like to calculate these monthly moving averages through July 2014 in SAS Enterprise Guide, however, the dates in my data set only go to July 2013 (because the historical data is only reported to the present date).  I have done extensive manipulation of my data set and it is difficult for me to go back and add those dates to the end of the Excel file that I originally pulled the data from.  Does anyone know of an easy way to add the dates to the end of my dataset and calculate the moving averages post-manipulation?

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

You can create the dates/data in a dataset and then append them, and then calculate your moving averages.

Does that make sense to you?

If so, provide a sample of what your data looks like, what you expect as output and someone can help with the coding or instructions on how to use EG to get it done.

View solution in original post

4 REPLIES 4
jakarman
Barite | Level 11

If your dataset is ordered ... would the lag funtion be helpful?

See: SAS(R) 9.4 Functions and CALL Routines: Reference   (lag samples - several: calculation moving average)

---->-- ja karman --<-----
claireluen
Calcite | Level 5

I don't think so.  Basically I just want to tack on 12 months to the end of my time series.  I know how to calculate the moving averages.  The problem is just that when my dates end, so does my dataset and the moving averages stop calculating.  I am looking for an easy way to extend my dates into 2014 so that I can get the moving averages for those months as well.

Reeza
Super User

You can create the dates/data in a dataset and then append them, and then calculate your moving averages.

Does that make sense to you?

If so, provide a sample of what your data looks like, what you expect as output and someone can help with the coding or instructions on how to use EG to get it done.

claireluen
Calcite | Level 5

The append is what I needed.  Thank you, Reeza.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1618 views
  • 0 likes
  • 3 in conversation