SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
drdee
Obsidian | Level 7

Hi, 

I'm using proc model to perform linear regression and want to apply the so-called White test that checks whether the residuals have constant variance.

Now I want these statistics in a dataset, so that I can use them for later processing, but how?

 

I have something of the form:

  proc model data=dataset;

    parms b0 b1;

    y = b0 + b1*x;

    fit y / white ;

  run;

 

and I am interested in getting the following output values in a dataset:

 

aa.png

 

Do you know how to do that?

 

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
sbxkoenk
SAS Super FREQ

Hello,

 

If you put

ODS TRACE ON; in front of your PROC MODEL

, you see the name of all output objects in the LOG.

 

Suppose the name of the output object you are interested in equals "white_heteroscedasticity".

Then specify just in front of your PROC MODEL:

ODS TRACE OFF;

ODS OUTPUT white_heteroscedasticity=work.my_white_dataset;

 

That's the way to capture output objects in a data set.

 

Good luck,

Koen

View solution in original post

6 REPLIES 6
sbxkoenk
SAS Super FREQ

Hello,

 

If you put

ODS TRACE ON; in front of your PROC MODEL

, you see the name of all output objects in the LOG.

 

Suppose the name of the output object you are interested in equals "white_heteroscedasticity".

Then specify just in front of your PROC MODEL:

ODS TRACE OFF;

ODS OUTPUT white_heteroscedasticity=work.my_white_dataset;

 

That's the way to capture output objects in a data set.

 

Good luck,

Koen

drdee
Obsidian | Level 7
Many thanks Koen, this works perfectly!
For later reference, I found the following in the log:

Output Added:
-------------
Name: HeteroTest
Label: Heteroscedasticity Test
Template: ets.model.HeteroTest
Path: Model.OLS.HeteroTest

and then used
ods output Model.OLS.HeteroTest=work.HeteroTest;
to write it to a dataset.
sbxkoenk
SAS Super FREQ

Hello @drdee ,

 

Thanks for having marked this topic as solved.

 

Concerning:

ods output Model.OLS.HeteroTest=work.HeteroTest;

... I was not even aware you could specify the "Path".

 

The "Name" should be enough, like

ods output HeteroTest=work.HeteroTest;

 

Kind regards,

Koen

drdee
Obsidian | Level 7
Hi again,
You are right of course, thanks.
Best, Dimitri
Reeza
Super User

 

Generally, here's some instructions and explanations on how to capture output that is shown.
https://blogs.sas.com/content/sastraining/2017/03/31/capturing-output-from-any-procedure-with-an-ods...

 

I'm not certain what the table name is from the limited output you've shown but guessing at HETERO test. The blog post above illustrates how to find the table names if needed or they're listed here. I find the ODS TRACE method simpler.

 

 
 proc model data=dataset;
ods output HeteroTest=want;
    parms b0 b1;
    y = b0 + b1*x;
    fit y / white ;
  run;

 

@drdee wrote:

Hi, 

I'm using proc model to perform linear regression and want to apply the so-called White test that checks whether the residuals have constant variance.

Now I want these statistics in a dataset, so that I can use them for later processing, but how?

 

I have something of the form:

  proc model data=dataset;

    parms b0 b1;

    y = b0 + b1*x;

    fit y / white ;

  run;

 

and I am interested in getting the following output values in a dataset:

 

aa.png

 

Do you know how to do that?

 

Thanks in advance


 

drdee
Obsidian | Level 7
Thank you very much, Reeze. The ODS TRACE method worked perfectly for me, so I accepted that answer.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2097 views
  • 5 likes
  • 3 in conversation