Forecasting using SAS Forecast Server, SAS/ETS, and more

Output Residual Correlation Diagnostics Proc ARIMA

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Output Residual Correlation Diagnostics Proc ARIMA

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.

 

Residual Correlation Diagnostics.PNG

 

My SAS version is 9.04.01M2P07232014.


Accepted Solutions
Solution
‎11-30-2016 01:50 PM
SAS Employee
Posts: 27

Re: Output Residual Correlation Diagnostics Proc ARIMA

Posted in reply to stwallace

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

View solution in original post


All Replies
Solution
‎11-30-2016 01:50 PM
SAS Employee
Posts: 27

Re: Output Residual Correlation Diagnostics Proc ARIMA

Posted in reply to stwallace

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

New Contributor
Posts: 2

Re: Output Residual Correlation Diagnostics Proc ARIMA

Excellent, that's what I needed.

 

Thanks,

 

Stephen

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 596 views
  • 1 like
  • 2 in conversation