In this note, see "Difference in Difference Analysis in a Pre/Post Longitudinal Study" in the "Generalized Linear Models with a Non-Identity Link" section. As shown there, you can use the Margins macro to estimate and test a hypothesis on the response means. You haven't stated exactly what you want to test, but assuming it is that the difference in the pre mean minus the average of the post means is the same in the two treatment groups, it would look like the Margins macro call in that section assuming that the POST variable has three levels (pre, 1yr, 2yr) in that order. Note that the contrast coefficients defining the hypothesis are applied to the margin estimates as displayed, so the ordering is important to proper interpretation.
data c;
length label f $32767;
infile datalines delimiter='|';
input label f;
datalines;
DID pre-avg.post | 1 -.5 -.5 -1 .5 .5
;
%Margins(data = data_set,
response = cost,
class = trt post,
model = trt|post,
link = log,
dist = gamma,
geesubject = id,
margins = trt post,
contrasts = c,
options = cl)
... View more