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.

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
  • 856 views
  • 0 likes
  • 3 in conversation