BookmarkSubscribeRSS Feed
jl2978
Fluorite | Level 6

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;
2 REPLIES 2
PaigeMiller
Diamond | Level 26

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.

 

 

--
Paige Miller
PGStats
Opal | Level 21

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)

PG

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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
  • 2 replies
  • 2184 views
  • 1 like
  • 3 in conversation