See this note on the difference in difference (DID), particularly the first section and the last section titled "Estimating the difference in difference in models with covariates". As noted the last section, the estimate from the LSMESTIMATE statement (for this model using the identity link) as shown in the first section is an estimate of the DID averaged over the levels of the additional categorical predictor. This is shown in the example below. Note that the first LSMESTIMATE statement (and the ESTIMATE statement) give the estimate of the DID averaged over the C levels. But this might not be advisable if the C*A*B interaction is significant since this means that the DID for A and B changes over the levels of C. The next three LSMESTIMATE statements estimate the separate A*B DIDs in the levels of C and then average them to also get the averaged DID over C. The next LSMESTIMATE statement estimates the difference in the two DIDs between the C levels which is the C*A*B interaction. Finally, the last statement re-estimates the separate DIDs in the C levels and produces a joint test of the hypothesis that they both are zero. Though GENMOD is used for a model not involving repeated measures, the same would apply to your case.
data a;
sd=3;
do c=1,0;
do a=1,0;
do b=1,0;
input mean @@;
do rep=1 to 10;
y=rannor(23425)*sd+mean;
output;
end;
end; end;end;
datalines;
50 70 40 40
60 90 20 40
;
proc genmod plots=none;
class a b c / ref=first;
model y = a|b|c;
estimate "Averaged DID" a*b 1 -1 -1 1;
lsmeans a*b*c;
lsmestimate a*b "Averaged DID" 1 -1 -1 1;
lsmestimate a*b*c "DID c=1" 1 0 -1 0 -1 0 1;
lsmestimate a*b*c "DID c=0" 0 1 0 -1 0 -1 0 1;
lsmestimate a*b*c "Averaged DID" 1 1 -1 -1 -1 -1 1 1 / divisor=2;
lsmestimate a*b*c "c*a*b = c Diff of a*b DIDs" 1 -1 -1 1 -1 1 1 -1 ;
lsmestimate a*b*c "DID c=1" 1 0 -1 0 -1 0 1, "DID c=0" 0 1 0 -1 0 -1 0 1 / joint(label="Test both c DIDs = 0");
run;
... View more