BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GreenTree1
Obsidian | Level 7

Hello everyone,

I am trying to do a DID analysis and difference in rate difference, where the rate is death rate (no of deaths/total number of infections) where death= 1/0

before and after an introduction of a vaccine (timeperiod= 0 is before and 1 is after), where vaccine= 0/1 for two different counties A and B.  For county B, the vaccine was never introduced. 

I have tried looking this up but most of the examples are based on differences in means. Also since my outcome of interest is death, the population is not the same across two the time periods.

Below is how my dataset looks like

county  death infection  vaccine  timeperiod  

A .          1 .     1 .             1              1
B .          1 .     1               0              1
A .          0 .     1               1              1
A .          0 .     1               1              1   
B .          0 .     1               0              1
A .          1 .     1               0              0
B            1       1               0              0

Please let me know if more I can clarify this further. 

Appreciate your help

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

Your response mean is a probability (limited to [0,1] range), not a rate that can exceed 1. To properly model a probability, you should either use PROC LOGISTIC or specify the DIST=BINOMIAL option in the MODEL statement in PROC GENMOD. If you want to estimate the difference in difference on the proportion scale, then you should use one of the methods discussed in this note

View solution in original post

3 REPLIES 3
GreenTree1
Obsidian | Level 7
Post update: proc genmod worked

proc genmod;
class a b / ref=first;
model y = a b a*b;
estimate "Diff in Diff" a*b 1 -1 -1 1;
lsmeans a*b;
lsmestimate a*b "Diff in Diff" 1 -1 -1 1;
run;

I had the interaction term mixed up.
StatDave
SAS Super FREQ

Your response mean is a probability (limited to [0,1] range), not a rate that can exceed 1. To properly model a probability, you should either use PROC LOGISTIC or specify the DIST=BINOMIAL option in the MODEL statement in PROC GENMOD. If you want to estimate the difference in difference on the proportion scale, then you should use one of the methods discussed in this note

GreenTree1
Obsidian | Level 7

Thanks for pointing that Statdave. It makes sense to use dist=binomial in proc genmod to model probability.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1186 views
  • 0 likes
  • 2 in conversation