Hi,
I'm doing a regression by groups. For each regression, I'm also doing an F-test. I encounter two problems with the F-test.
First, the F-test will be v3 * myvar + v4 =0, where myvar also varies for each group.
Second, how can I output the F-test to the table?
I'm trying to write the following code, but it didn't work...
Thanks!
proc reg noprint data=reg_in outest=reg_out ;
model dep = v1 v2 v3 v4;
by group_id myvar;
t1: test v3*myvar+v4 =0;
run;
The TEST statement has to include variables in the model. It cannot include variables in a BY statement.
Although you could re-parameterize the whole thing to get a model that is equivalent to having MYVAR in a BY statement, I still don't think you use the TEST statement in the way you want. I think you can test constant*v3+v4=0, but I don't think you can test something like variable1*variable2+variable3 = 0.
You could get that test by rescaling v3:
data test_in_2;
set test_in;
v3_myVar = v3 / myVar;
run;
proc reg noprint data=reg_in_2 outest=reg_out ;
model dep = v1 v2 v3_myVar v4;
by group_id myvar;
t1: test v3_myvar + v4 =0;
ods output ParameterEstimates=PE TestANOVA=TA;
run;
Datasets PE and TA will contain the estimates and test results and also the value of myvar so that you can recalculate the v3 statistics.
(untested)
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.