Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Forecasting
- /
- how to run ARMA(p, q) model with controls in PROC ARIMA

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 05-27-2020 04:35 AM
(834 views)

Dear SAS community, I would like to:

1) run ARMA (1,2) model for "change in sale", with control variables price and income:

change in sale = f(price, income, lag1 of change in sale, lag1 error, lag2 error, error term)

2) plot the residuals.

3) save the output, including original data, parameters and residuals.

It is something like the following, could you kindly help to correct? Thanks in advance!

```
proc arima data=have;
identify var=sales(1) crosscorr=(price income) noprint;
estimate input=(price income) plot;
run;
estimate p=1 q=2 input=(price income) outest=arma_sale;
run;
```

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi @JacAder,

PROC ARIMA can be used to fit a regression model with ARMA errors, as shown in the link below:

However, if you want to fit the model:

"change in sale = f(price, income, lag1 of change in sale, lag1 error, lag2 error, error term)"

then you can use other SAS procedures, such as PROC UCM or PROC VARMAX. For your desired model, PROC VARMAX provides the most straightforward approach. Your model, residual plot, and saved output can be obtained with the following code. Note: Although PROC VARMAX supports an OUTEST= data set, the code below illustrates how to output the ParameterEstimates table via an ODS OUTPUT statement. It saves the parameter estimates table in a different format than the OUTEST= data set.

```
proc varmax data=have plots=(model residual);
ods output ParameterEstimates=arma_est;
id date interval=month;
model sales = price income / p=1 q=2 dify(1);* difx(1);
output out=out lead=0;
run;
proc print data=arma_est;
run;
data all_varmax;
merge have out;
by date;
run;
proc print data=all_varmax;
var date sales price income for1 res1;
run;
```

When the response variable is differenced, it is common to apply the same order of differencing to the input variables as well. I included the DIFX option in the MODEL statement to illustrate how to difference the input variables, but commented it out, since that was not used in your model description.

For more details on the mathematical models fit by the ARIMA and VARMAX procedures, please see the following links:

I hope this helps!

DW

2 REPLIES 2

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi @JacAder,

PROC ARIMA can be used to fit a regression model with ARMA errors, as shown in the link below:

However, if you want to fit the model:

"change in sale = f(price, income, lag1 of change in sale, lag1 error, lag2 error, error term)"

then you can use other SAS procedures, such as PROC UCM or PROC VARMAX. For your desired model, PROC VARMAX provides the most straightforward approach. Your model, residual plot, and saved output can be obtained with the following code. Note: Although PROC VARMAX supports an OUTEST= data set, the code below illustrates how to output the ParameterEstimates table via an ODS OUTPUT statement. It saves the parameter estimates table in a different format than the OUTEST= data set.

```
proc varmax data=have plots=(model residual);
ods output ParameterEstimates=arma_est;
id date interval=month;
model sales = price income / p=1 q=2 dify(1);* difx(1);
output out=out lead=0;
run;
proc print data=arma_est;
run;
data all_varmax;
merge have out;
by date;
run;
proc print data=all_varmax;
var date sales price income for1 res1;
run;
```

When the response variable is differenced, it is common to apply the same order of differencing to the input variables as well. I included the DIFX option in the MODEL statement to illustrate how to difference the input variables, but commented it out, since that was not used in your model description.

For more details on the mathematical models fit by the ARIMA and VARMAX procedures, please see the following links:

I hope this helps!

DW

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

That's very helpful, thanks a lot!

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. **Registration is now open through August 30th**. Visit the SAS Hackathon homepage.

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.