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

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