Help using Base SAS procedures

Two-way ANOVA with and without interaction

Reply
Contributor
Posts: 23

Two-way ANOVA with and without interaction

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

Respected Advisor
Posts: 4,651

Re: Two-way ANOVA with and without interaction

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

PG
Trusted Advisor
Posts: 1,616

Re: Two-way ANOVA with and without interaction

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"?

Ask a Question
Discussion stats
  • 2 replies
  • 151 views
  • 0 likes
  • 3 in conversation