which option will help to include result of test statement in the output

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 130
Accepted Solution

which option will help to include result of test statement in the output

[ Edited ]

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:

test1.jpgtest2.jpg


Accepted Solutions
Solution
‎11-11-2015 10:29 PM
Respected Advisor
Posts: 4,932

Re: which option will help to include F-test result in the output

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

View solution in original post


All Replies
Solution
‎11-11-2015 10:29 PM
Respected Advisor
Posts: 4,932

Re: which option will help to include F-test result in the output

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
Frequent Contributor
Posts: 130

Re: which option will help to include F-test result in the output

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

 

 

Respected Advisor
Posts: 4,932

Re: which option will help to include F-test result in the output

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
Frequent Contributor
Posts: 130

Re: which option will help to include F-test result in the output

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

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 328 views
  • 2 likes
  • 2 in conversation