Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- ADF test in output file

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 10-17-2018 02:19 PM
(3353 views)

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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.

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

6 REPLIES 6

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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.

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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;

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;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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,

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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;`

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

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.

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