ODS OUTPUT in presence of BY statement only outputs results for first BY group in PROC ARIMA


When PROC ARIMA is run with a BY statement and an ODS OUTPUT statement is used to output to a data set the results contained in a table produced by PROC ARIMA, only the results from the first BY group are written to the output data set created by the ODS OUTPUT statement. In order to obtain a data set with the results from all of the BY groups, the ODS OUTPUT options, MATCH_ALL and PERSIST=PROC, must be used (even though these options should no longer be necessary).

The following example illustrates how to output the ChiSqAuto ODS table to an output data set when a BY statement is used in PROC ARIMA:

ods output ChiSqAuto(match_all=q persist=proc)=qstats;
proc arima data=a;
   by cusip;
   identify var=y;
   run;
   quit;

data all_qstats;
   set &q;
   run;

proc print data=all_qstats;
   run;

Note: It is also recommended that a QUIT; statement be specified whenever ODS is used with the ARIMA procedure, since PROC ARIMA is an interactive procedure.