turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Forecasting
- /
- Re: Output Residual Correlation Diagnostics Proc A...

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-29-2016 11:01 AM

Hello,

I am trying to automate ARIMA model selection using PROC ARIMA, and I want to output the residual correlation diagnostics (ACF, PACF, IACF, and White Noise Prob for resididuals) into a dataset, but I can't figure out how.

My SAS version is 9.04.01M2P07232014.

Accepted Solutions

Highlighted
## Re: Output Residual Correlation Diagnostics Proc ARIMA

Options

Solution

11-30-2016
01:50 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-30-2016 01:22 PM

Hi,

You can use ODS (Output Delivery System) to output to a SAS data set all of the values used to create each of the plots in this graphics panel produced by PROC ARIMA. In order to do this, you must first determine the name of the ODS graph. To do that, you can add these statements immediately before your PROC ARIMA step:

```
ods listing;
ods trace on / listing;
```

The ODS LISTING; statement tells SAS to open up the listing destination, and the ODS TRACE ON / LISTING; statement tells SAS to interleave tracing information, including the ODS table and graph names, with the (non-graphical) output generated by the procedure. Even though ODS graphics are not written to the listing destination, the ODS graph *names* produced by the ODS TRACE ON statement are written to the listing (ie. output) file.

When you include the above statements prior to your PROC ARIMA step and rerun your analysis (making sure you have a QUIT; statement to end your interactive PROC ARIMA step), you will see that the name of the ODS graph of interest to you is **ResidualCorrPanel**.

Now that you know the name of the ODS graph whose data values you want to output to a data set, you can turn the tracing information off via an ODS TRACE OFF; statement, add an ODS OUTPUT statement to your code, and rerun your PROC ARIMA analysis. The ODS OUTPUT statement in your PROC ARIMA step writes the data used to generate the graph to a SAS data set. The syntax is: ODS OUTPUT graphname=datasetname;

Following, please find an example to illustrate the above steps:

```
data a;
set sashelp.air;
y=log(air);
run;
ods listing;
ods trace on / listing;
proc arima data=a;
identify var=y(1,12);
estimate q=(1)(12);
run;
quit;
ods trace off;
proc arima data=a;
ods output ResidualCorrPanel=residcorr;
identify var=y(1,12);
estimate q=(1)(12);
run;
quit;
proc print data=residcorr;
run;
```

For more details on using ODS to output tables (and graphics data) to a SAS data set, please see SAS Usage Note 22949.

Regarding your application, please note that SAS Forecast Server and SAS Forecasting for Desktop offer built-in functionality for automatic model selection of time series models, including univariate ARIMA and transfer function models. The AUTOMDL statement in PROC X12 (X13) might also be helpful for automatic selection of an ARIMA model, but the methodology supported by this procedure is only available for monthly or quarterly time series.

I hope this helps!

DW

All Replies

Highlighted
## Re: Output Residual Correlation Diagnostics Proc ARIMA

Options

Solution

11-30-2016
01:50 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-30-2016 01:22 PM

Hi,

You can use ODS (Output Delivery System) to output to a SAS data set all of the values used to create each of the plots in this graphics panel produced by PROC ARIMA. In order to do this, you must first determine the name of the ODS graph. To do that, you can add these statements immediately before your PROC ARIMA step:

```
ods listing;
ods trace on / listing;
```

The ODS LISTING; statement tells SAS to open up the listing destination, and the ODS TRACE ON / LISTING; statement tells SAS to interleave tracing information, including the ODS table and graph names, with the (non-graphical) output generated by the procedure. Even though ODS graphics are not written to the listing destination, the ODS graph *names* produced by the ODS TRACE ON statement are written to the listing (ie. output) file.

When you include the above statements prior to your PROC ARIMA step and rerun your analysis (making sure you have a QUIT; statement to end your interactive PROC ARIMA step), you will see that the name of the ODS graph of interest to you is **ResidualCorrPanel**.

Now that you know the name of the ODS graph whose data values you want to output to a data set, you can turn the tracing information off via an ODS TRACE OFF; statement, add an ODS OUTPUT statement to your code, and rerun your PROC ARIMA analysis. The ODS OUTPUT statement in your PROC ARIMA step writes the data used to generate the graph to a SAS data set. The syntax is: ODS OUTPUT graphname=datasetname;

Following, please find an example to illustrate the above steps:

```
data a;
set sashelp.air;
y=log(air);
run;
ods listing;
ods trace on / listing;
proc arima data=a;
identify var=y(1,12);
estimate q=(1)(12);
run;
quit;
ods trace off;
proc arima data=a;
ods output ResidualCorrPanel=residcorr;
identify var=y(1,12);
estimate q=(1)(12);
run;
quit;
proc print data=residcorr;
run;
```

For more details on using ODS to output tables (and graphics data) to a SAS data set, please see SAS Usage Note 22949.

Regarding your application, please note that SAS Forecast Server and SAS Forecasting for Desktop offer built-in functionality for automatic model selection of time series models, including univariate ARIMA and transfer function models. The AUTOMDL statement in PROC X12 (X13) might also be helpful for automatic selection of an ARIMA model, but the methodology supported by this procedure is only available for monthly or quarterly time series.

I hope this helps!

DW

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-30-2016 01:51 PM

Excellent, that's what I needed.

Thanks,

Stephen