options ls=75; data one; input cohort $ @; do subj=1 to 7; input y @; if cohort="I" then do; gender="W"; age="y"; end; else if cohort="II" then do; gender="M"; age="y";end; else if cohort="III" then do; gender="W" ; age="o";end; else if cohort="IV" then do; gender="M" ; age="o";end; old=(age='o'); women=(gender='W'); oldwomen=old*women; output; end; cards; I 221 213 202 183 185 197 162 II 271 192 189 209 227 236 142 III 262 193 224 201 161 178 265 IV 192 253 248 278 232 267 289 ; run; proc glm order=data; class age gender; model y=age|gender; means age|gender; estimate "mu[AB]:interaction" age*gender -1 1 1 -1; run; endsas; /*proc reg; model y=old women oldwomen/covb; run;*/ /*proc means var; class cohort; var y; run;endsas; */ proc glm; class cohort; model y=cohort/clparm; estimate "simple effect of gender - young" cohort -1 1; estimate "simple effect of gender - old" cohort 0 0 -1 1; constrast "main effect of age " cohort -1 -1 1 1; constrast "main effect of gender" cohort -1 1 -1 1; constrast "interaction effect " cohort -1 1 1 -1; estimate "main effect of age " cohort -1 -1 1 1/divisor=2; estimate "main effect of gender" cohort -1 1 -1 1/divisor=2; estimate "interaction effect " cohort -1 1 1 -1; run; proc glm; class age gender; model y=age|gender/solution ss1 ss2 ss3 ; estimate "mu[AB1]" age -1 1 gender*age -1 0 1 0; output out=two p=ymean; lsmeans age|gender/tdiff; *means age*gender; run; *goptions colors=(black) dev=pslepsf; *goptions colors=(black); symbol1 i=join l=1 value=dot; symbol2 i=join l=2 value=dot; proc gplot; title "interaction plot"; plot ymean*age=gender; run; quit;