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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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