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

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

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

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:

adfout.png

 

 

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.

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.

View solution in original post

6 REPLIES 6
ChrisHemedinger
Community Manager

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.

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
Dim13
Obsidian | Level 7
Thank you for the reply. This command solves the "noprint" option but it does not produce the Adf statistic in the out1 file. Moreover, none of the available options in the output statement (http://support.sas.com/documentation/cdl/en/etsug/63939/HTML/default/viewer.htm#etsug_autoreg_sect01... ) of the "proc autoreg" procedure write the adf in a file.
For example , in the following mock data

DATA t1;
INPUT variablex ;
DATALINES ;
1
3
4
10
6
7
6
7
8
9
0
8
;
RUN;

proc autoreg data=t1;
model variablex= / stationarity =(adf=3) noprint;
output out=t2;
run;

the adf test without the "noprint" command is (with trend) -1.2062 with a p-value of 0.8276. It is these values that I need to add in a file (the tau value and the pr
Thank you

ChrisHemedinger
Community Manager

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:

adfout.png

 

 

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.

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
Dim13
Obsidian | Level 7
Hello Chris,
thank you very much, since I needed to run this a couple of thousand times I added on your suggestion a simple "printto" command so that I can divert this to a word file. So here is what worked and thanks again

DATA t1;
INPUT variablex ;
DATALINES ;
1
3
4
10
6
7
6
7
8
9
0
8
;
RUN;
options nonotes;
proc printto print='c:\sas\dd.doc' new;
run;
ods output adf=temp30;

proc autoreg data=t1;
model variablex= / stationarity =(adf=3) ;
run;


rosiecao2509
Fluorite | Level 6

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,

 

ChrisHemedinger
Community Manager

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;

 

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 3354 views
  • 1 like
  • 3 in conversation