Hello Everyone,
first time asking question in forum. I wanted to ask if there is a way I can run a test for Unit roots and keep the ADF test in a file rather than the output window (i.e. in the work folder- preferably the p-value). A "noprint" option would also be nice. Thanks a lot
You can get the values by using ODS OUTPUT.
First, enable ODS TRACE to learn the name of the table you need:
ods trace on;
Run PROC AUTOREG without the NOPRINT option. In the log you'll find:
Output Added: ------------- Name: ADF Label: Augmented Dickey-Fuller Tests Template: ets.autoreg.ADF Path: Autoreg.Model1.OLSEst.TestingForStationarity.ADF -------------
From this, we know the ODS table we want is "ADF". Add the ODS OUTPUT statement before your PROC AUTOREG:
ods output adf=adf_out;
proc autoreg data=t1;
model variablex= / stationarity =(adf=3) ;
run;
Resulting data set:
Because this relies on ODS, and the NOPRINT option would suppress the ODS output, you can't include the NOPRINT option on the MODEL statement.
Is this from PROC AUTOREG? The MODEL statement has a NOPRINT option, and the proc has an OUTPUT option. Example:
proc autoreg data = gnp;
model y = / stationarity =(adf =3) NOPRINT;
output out=out1; /* specify option for specific values to save */
run;
Lifted/adapted code from this example.
You can get the values by using ODS OUTPUT.
First, enable ODS TRACE to learn the name of the table you need:
ods trace on;
Run PROC AUTOREG without the NOPRINT option. In the log you'll find:
Output Added: ------------- Name: ADF Label: Augmented Dickey-Fuller Tests Template: ets.autoreg.ADF Path: Autoreg.Model1.OLSEst.TestingForStationarity.ADF -------------
From this, we know the ODS table we want is "ADF". Add the ODS OUTPUT statement before your PROC AUTOREG:
ods output adf=adf_out;
proc autoreg data=t1;
model variablex= / stationarity =(adf=3) ;
run;
Resulting data set:
Because this relies on ODS, and the NOPRINT option would suppress the ODS output, you can't include the NOPRINT option on the MODEL statement.
Hi Chris,
I just used your code to output out the ADF test, which works very well. I did the same for Phillips Perron test (change adf ==> pp) but it just does not work. Can you please advise me on this?
Thanks so much,
Different tests use different output tables in ODS. The names are documented here for PROC AUTOREG.
So change the ODS OUTPUT to:
ods output PhilPerron=pp_out;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.