SAS Forecasting and Econometrics

Forecasting using SAS Visual Forecasting, SAS Forecast Server, SAS Econometrics and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ujjawal
Quartz | Level 8

I am trying to calculate forecasted value using moving average. I am getting different result using PROC EXPAND and PROC ARIMA

 

 

Proc expand data= data1 out= new_mydata;
convert sales = sales_movave / transformout=(movave 3);
run;

proc arima data=WORK.DATA1 plots=none out=WORK.out0001;
	identify var=Sales;
	estimate p=(1 2 3) ar=(0.3333333333333333 0.3333333333333333 
		0.3333333333333333) noint method=ULS;
	forecast lead=12;
	run;
quit;

 

1 ACCEPTED SOLUTION

Accepted Solutions
alexchien
Pyrite | Level 9

1. proc expand computes the moving average (movave)  as sales_moave_t = (sales_t-2 + sales_t-1 + sales_t)/3. This is probably not you wanted.

2. proc arima gives you exactly what you are looking for but you need to add a few options to make it work. sales_moave_t = (sales_t-3 + sales_t-2 + sales_t-1)/3

 

the correct syntax should be

proc arima data=WORK.DATA1 plots=none out=WORK.out0001;
	identify var=Sales;
	estimate p=(1 2 3) ar=(0.3333333333333333 0.3333333333333333 
		0.3333333333333333) noint noest nostable method=CLS;
	forecast lead=12;
	run;
quit;

 

Without noest nostable, proc arima will use the provided ar values as the initial values and try to estimate them. Thus you might end up with something that's not equally weighted moving averages.

hope this helps

alex

View solution in original post

3 REPLIES 3
Reeza
Super User

@Ujjawal wrote:

I am trying to calculate forecasted value using moving average. I am getting different result using PROC EXPAND and PROC ARIMA

 

 

Proc expand data= data1 out= new_mydata;
convert sales = sales_movave / transformout=(movave 3);
run;

 


PROC EXPAND doesn't do forecasting.

Puwang
Obsidian | Level 7

In your PROC ARIMA statement, p= and ar= specifies AutoRegressive paramters. If you want to do moving average, you need to use q= and MA=. As follows:

proc arima data=WORK.DATA1 plots=none out=WORK.out0001;
	identify var=Sales;
	estimate Q=(1 2 3) MA=(0.3333333333333333 0.3333333333333333 
		0.3333333333333333) noint method=ULS;
	forecast lead=12;
	run;
quit;
alexchien
Pyrite | Level 9

1. proc expand computes the moving average (movave)  as sales_moave_t = (sales_t-2 + sales_t-1 + sales_t)/3. This is probably not you wanted.

2. proc arima gives you exactly what you are looking for but you need to add a few options to make it work. sales_moave_t = (sales_t-3 + sales_t-2 + sales_t-1)/3

 

the correct syntax should be

proc arima data=WORK.DATA1 plots=none out=WORK.out0001;
	identify var=Sales;
	estimate p=(1 2 3) ar=(0.3333333333333333 0.3333333333333333 
		0.3333333333333333) noint noest nostable method=CLS;
	forecast lead=12;
	run;
quit;

 

Without noest nostable, proc arima will use the provided ar values as the initial values and try to estimate them. Thus you might end up with something that's not equally weighted moving averages.

hope this helps

alex

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Discussion stats
  • 3 replies
  • 3605 views
  • 2 likes
  • 4 in conversation