options ls=105 nodate; data bees; drop i; input trt temp suc @; do i=1 to 3; input y @; ly=log(y); output; end; cards; 1 20 20 3.1 3.7 4.7 2 20 40 5.5 6.7 7.3 3 20 60 7.9 9.2 9.3 4 30 20 6 6.9 7.5 5 30 40 11.5 12.9 13.4 6 30 60 17.5 15.8 14.7 7 40 20 7.7 8.3 9.5 8 40 40 15.7 14.3 15.9 9 40 60 19.1 18.0 19.9 ; run; symbol i=rl value=dot; proc gplot data=bees; plot y*temp=suc; plot y*suc=temp; run; symbol i=rq value=dot; proc gplot data=bees; plot y*temp=suc; plot y*suc=temp; run; proc glm data=bees; class suc temp; model y=suc|temp; /* all coefficients below depend on this ordering */ estimate "temp linear for low sucrose (div=20)" temp -1 0 1 suc*temp -1 0 1/divisor=20; estimate "temp linear for medium sucrose (div=20)" temp -1 0 1 suc*temp 0 0 0 -1 0 1/divisor=20; estimate "temp linear for high sucrose (div=20)" temp -1 0 1 suc*temp 0 0 0 0 0 0 -1 0 1/divisor=20; estimate "linear temp equal for suc=40,60 (div=20)" suc*temp 0 0 0 -1 0 1 1 0 -1/divisor=20; estimate "lintemp for s20 - lintemp for s40,60 (div=40)" suc*temp -2 0 2 1 0 -1 1 0 -1/divisor=40; estimate "temp quad for low sucrose " temp 1 -2 1 suc*temp 1 -2 1 ; estimate "temp quad for medium sucrose " temp 1 -2 1 suc*temp 0 0 0 1 -2 1 ; estimate "temp quad for high sucrose " temp 1 -2 1 suc*temp 0 0 0 0 0 0 1 -2 1 ; contrast "temp linear for low sucrose " temp -1 0 1 suc*temp -1 0 1; contrast "temp linear for medium sucrose " temp -1 0 1 suc*temp 0 0 0 -1 0 1; contrast "temp linear for high sucrose " temp -1 0 1 suc*temp 0 0 0 0 0 0 -1 0 1; contrast "linear temp equal for suc=40,60 " suc*temp 0 0 0 -1 0 1 1 0 -1; contrast "lintemp for s20 - lintemp for s40,60 " suc*temp -2 0 2 1 0 -1 1 0 -1; contrast "temp quad for low sucrose " temp 1 -2 1 suc*temp 1 -2 1 ; contrast "temp quad for medium sucrose " temp 1 -2 1 suc*temp 0 0 0 1 -2 1 ; contrast "temp quad for high sucrose " temp 1 -2 1 suc*temp 0 0 0 0 0 0 1 -2 1 ; contrast "lintemp,quadtemp equal for suc=40,60 " suc*temp 0 0 0 -1 0 1 1 0 -1, suc*temp 0 0 0 -1 2 -1 1 -2 1; run; proc sort; by suc; run; proc glm; by suc; model y=temp /solution; *model y=temp temp*temp/solution; run; proc glm; model y=temp temp*temp suc suc*suc temp*suc temp*temp*suc temp*suc*suc temp*temp*suc*suc; run; /* for an interaction plot with means use code below */ proc means data=bees noprint ; /* to avoid the marginal means, try the NWAY option */ *proc means data=bees noprint NWAY ; class temp suc; var y; output out=beemeans mean=ymean; run; symbol1 i=join; proc gplot data=beemeans; plot ymean*temp=suc; run; /* if only pairwise comparisons are of interest, here's one way to code them*/ proc glm data=bees; class temp suc; /*order different than above */ model y=temp|suc; estimate "mu13-mu11" suc -1 0 1 temp*suc -1 0 1 0 0 0 0 0 0; estimate "mu23-mu21" suc -1 0 1 temp*suc 0 0 0 -1 0 1 0 0 0; estimate "mu33-mu31" suc -1 0 1 temp*suc 0 0 0 0 0 0 -1 0 1; estimate "mu13-mu12" suc 0 -1 1 temp*suc 0 -1 1 0 0 0 0 0 0; estimate "mu23-mu22" suc 0 -1 1 temp*suc 0 0 0 0 -1 1 0 0 0; estimate "mu33-mu32" suc 0 -1 1 temp*suc 0 0 0 0 0 0 0 -1 1; estimate "mu12-mu11" suc -1 1 0 temp*suc -1 1 0 0 0 0 0 0 0; estimate "mu22-mu21" suc -1 1 0 temp*suc 0 0 0 -1 1 0 0 0 0; estimate "mu32-mu31" suc -1 1 0 temp*suc 0 0 0 0 0 0 -1 1 0; means temp*suc; output out=two p=p; run; /*log-transformed analysis */ proc glm data=bees; class temp suc; model ly=temp|suc; output out=logbeemeans p=lymean; run; symbol1 i=rq value=dot; proc gplot data=bees; plot ly*temp=suc; run; symbol1 i=join value=dot; proc gplot data=logbeemeans; title "effects look additive on log-scale for energy"; plot lymean*temp=suc; run;