BookmarkSubscribeRSS Feed
SASstudent2013
Calcite | Level 5

Hello, I need to perform 2-way ANOVA with and without interaction. I am wondering if the code below is correct? Variable 'sex' can be a 1 or 2, variable 'agegrp' can be a 1, 2, or 3, and variable peri is a continuous variable that is a measurement. I need to interpret the coefficient for sex in the one without interaction, and then determine whether agegrp is an effect modifier.  Code and output are below. Any and all advice is appreciated!! I'm not sure if I have this setup correctly or not.

CODE:

/*Two way ANOVA by age group and sex with no interaction term. Save the predicted values into a data set called out1*/

proc glm data=bone;

class sex agegrp;

model peri = sex agegrp;

output out=out1;

run;

proc print data=out1;

run;

/*Two way ANOVA by age group and sex with interaction. Save the predicted values into a data set called out2*/

proc glm data=bone;

class sex agegrp;

model peri = sex agegrp sex*agegrp;

estimate 'gender: age group = < 12' sex 1 -1 agegrp*sex 1 0 0 -1 0 0;

estimate 'gender: age group = between 12 and 20' sex 1 -1 agegrp*sex 0 1 0 0 -1 0;

estimate 'gender: age group = 20 and older' sex 1 -1 agegrp*sex 0 0 1 0 0 -1;

output out=out2;

run;

OUTPUT -without interaction:

The GLM Procedure

Dependent Variable: peri

        
Model338215.0843112738.36144311.43<.0001
Error66127036.9555540.90311
Corrected Total66465252.03987

     
0.58565310.102236.39555463.30836

        
sex12846.676572846.6765769.60<.0001
agegrp235368.4077417684.20387432.34<.0001

        
sex12377.641382377.6413858.13<.0001
agegrp235368.4077417684.20387432.34<.0001

OUTPUT - with interaction:

Dependent Variable: peri

        
Model539885.945367977.18907207.24<.0001
Error65925366.0945138.49180
Corrected Total66465252.03987

     
0.6112609.7999326.20417663.30836

        
sex12846.676572846.6765773.96<.0001
agegrp235368.4077417684.20387459.43<.0001
sex*agegrp21670.86105835.4305221.70<.0001

        
sex13354.123073354.1230787.14<.0001
agegrp236322.3008918161.15045471.82<.0001
sex*agegrp21670.86105835.4305221.70<.0001

       
gender: age group = < 120.568999070.701191380.810.4174
gender: age group = between 12 and 205.886974220.799629577.36<.0001
gender: age group = 20 and older8.493028971.197283447.09<.0001

2 REPLIES 2
PGStats
Opal | Level 21

Hi. What is the intended purpose of your ESTIMATE statements? - PG

PG
PaigeMiller
Diamond | Level 26

I need to interpret the coefficient for sex in the one without interaction, and then determine whether agegrp is an effect modifier.

You don't ask SAS to compute the coefficients. You can't interpret them unless you have SAS compute them.

Also, I am not familiar with the phrase "effect modifier". Does that mean "interaction is statistically significant"?

--
Paige Miller

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1549 views
  • 0 likes
  • 3 in conversation