BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
stwallace
Calcite | Level 5

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.

1 ACCEPTED SOLUTION

Accepted Solutions
dw_sas
SAS Employee

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

2 REPLIES 2
dw_sas
SAS Employee

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

stwallace
Calcite | Level 5

Excellent, that's what I needed.

 

Thanks,

 

Stephen

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!

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.

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