Chapter Contents |
Previous |
Next |
Using the Output Delivery System |
The ODS OUTPUT statement creates SAS data sets from ODS tables. In the following example, the AUTOREG procedure is invoked to estimate a large number of Dickey-Fuller type regressions and part of the resulting procedure output is output to a SAS data set. The Dickey-Fuller t-statistic is then calculated and PROC MEANS is used to calculate the empirical critical values.
The data set UNITROOT contains 10,000 unit root time series.
data unitroot; YLag = 0; do rep = 1 to 10000; do time = -50 to 100; Y = YLag + rannor(123); if time > 0 then output; YLag = Y; end; end; run;
data test; YLag = 0; do time = -50 to 100; Y = YLag + rannor(123); if time > 0 then output; YLag = Y; end; run; ods trace on; ods listing close; proc autoreg data=test; model Y = YLag; run; ods trace off; ods listing;Output 6.5.1: The ODS TRACE: Partial Contents of the SAS Log
|
ods output ParameterEstimates = myParms (keep=Variable Estimate StdErr where=(Variable='YLag')) ; ods exclude all; proc autoreg data=unitRoot; by rep; model Y = YLag; run;
The KEEP= option in the ODS OUTPUT statement specifies that only the variables Variable, Estimate, and StdErr are written to the data set. The WHERE= option selects the specific variable in which we are interested , YLag. The AUTOREG procedure is again invoked. In order to limit the amount of displayed output, the ODS exclusion list is set to ALL.
In the following statements, the output data set myParms is used to create the data set TDISTN which contains the Dickey-Fuller t-statistics. PROC MEANS is then utilized to tabulate the empirical 1, 5, and 10 percent critical values. The results are displayed in Output 6.5.2.
data tdistn; set myParms; tStat = (Estimate-1)/StdErr; run; ods select Means.Summary; proc means data=tDistn P1 P5 P10 fw=5; var tStat; title 'Simulated Dickey-Fuller Critical Values'; run;Output 6.5.2: The Empirical Critical Values, Tabulated by PROC MEANS
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.