turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- General Programming
- /
- which option will help to include result of test s...

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-11-2015 02:54 PM - edited 11-11-2015 10:06 PM

In the following example, I would like to include result of test statement for model1 and mode2 in the output table "**betas_type** ", which option should I use? thanks!

data htwt;

input id age height weight exercise;

datalines;

1 1 56 140 3

2 1 60 155 3

3 1 64 143 3

4 1 68 161 3

5 1 72 139 3

6 1 54 159 3

7 1 62 138 3

8 1 65 121 3

9 1 65 161 4

10 1 70 145 4

11 2 56 117 4

12 2 60 125 4

13 2 64 133 4

14 2 68 141 3

15 2 72 149 3

16 2 54 109 5

17 2 62 128 5

18 2 65 131 5

19 2 65 131 5

20 2 70 145 5

21 3 64 211 5

22 3 68 223 4

23 3 72 235 4

24 3 76 247 4

25 3 80 259 4

26 3 62 201 5

27 3 69 228 5

28 3 74 245 5

29 3 75 241 5

30 3 82 269 5

;

run;

data htwt2;

set htwt;

if age = 1 then age1 = 1; else age1 = 0;

if age = 2 then age2 = 1; else age2 = 0;

age1ht = age1*height;

age2ht = age2*height;

age1ex = age1*exercise;

age2ex = age2*exercise;

run;

proc reg data=htwt2 outest = **betas_type** tableout rsquare adjrsq edf noprint;

model1: model weight = age1 age2 height age1ht age2ht/white;**test** age1ht=0, age2ht=0;

model2: model weight = age1 age2 exercise age1ex age2ex/white;**test** age1ex=0, age2ex=0;

quit;

**p.s. I tried the following approach, though I can save the results, it is not helpful because I have thousands of regression results, and I need to read one by one.**

filename myhtml "C:\outputdata\procreg.html";

ods html body=myhtml;

proc reg data=htwt2 outest = betas_type tableout rsquare adjrsq edf ;

model1: model weight = age1 age2 height age1ht age2ht/white;

test age1ht=0, age2ht=0;

model2: model weight = age1 age2 exercise age1ex age2ex/white;

test age1ex=0, age2ex=0;

run;

quit;

ods html close;

I would like to save the following information from "test" statement:

Accepted Solutions

Solution

11-11-2015
10:29 PM

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Jonate_H

11-11-2015 03:15 PM

You need ODS output, as in:

```
ods select none;
proc reg data=htwt2 plots=none;
ods output ANOVA=htwt2ANOVA;
model1: model weight = age1 age2 height age1ht age2ht/white;
test age1ht=0, age2ht=0;
model2: model weight = age1 age2 exercise age1ex age2ex/white;
test age1ex=0, age2ex=0;
quit;
ods select all;
```

PG

All Replies

Solution

11-11-2015
10:29 PM

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Jonate_H

11-11-2015 03:15 PM

You need ODS output, as in:

```
ods select none;
proc reg data=htwt2 plots=none;
ods output ANOVA=htwt2ANOVA;
model1: model weight = age1 age2 height age1ht age2ht/white;
test age1ht=0, age2ht=0;
model2: model weight = age1 age2 exercise age1ex age2ex/white;
test age1ex=0, age2ex=0;
quit;
ods select all;
```

PG

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to PGStats

11-11-2015 04:21 PM

Thank you PG!

and, I just realized that I also need the results from both test statements. so rather than use ANOVA=, which option I should use?

In the output window, the results look like:

__ Test 1__ Results for Dependent Variable weight

Mean

Source DF Square F Value Pr > F

Numerator 2 1092.77178 17.29 <.0001

Denominator 24 63.19356

__ Test 1__ Results using Heteroscedasticity

Consistent Covariance Estimates

DF Chi-Square Pr > ChiSq

2 105.78 <.0001

__ Test 2__ Results for Dependent Variable weight

Mean

Source DF Square F Value Pr > F

Numerator 2 164.77385 0.64 0.5386

Denominator 24 259.45321

__ Test 2__ Results using Heteroscedasticity

Consistent Covariance Estimates

DF Chi-Square Pr > ChiSq

2 3.56 0.1689

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Jonate_H

11-11-2015 10:21 PM

ODS table names are listed in the **Details** section of the proc documentation. To see which ods tables are produced by your analysis, put the statement

**ODS trace on;**

before calling proc REG. From the information you have given, I would guess that you want tables **ACovTestANOVA** and/or **TestANOVA**.

PG

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to PGStats

11-11-2015 10:29 PM

REALLY APPRECIATED! it is the testanova! I was looking for that table name for a whole day! should read the document more careful.