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.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

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.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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;

 

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

sas-innovate-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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