Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Difference-in-difference coding/syntax


    Hi,

    Just a quick question regarding the Stata code. I’m running a difference in difference analysis and I have two models, one where the treatment is if a woman has given birth to a son, and the other is if a woman has had any additional children. I have two dummy variables, one is whether a woman has given birth, the other whether a woman has a son or not. I also have another variable that counts the total number of children a woman has. To generate the variables for the first model I run the following code:

    Code:
    **Time period= 2006 pre 2012 post**
    ***treatment= has a child and that child is a boy***
     
     
    *** Difference in Difference estimations with individuals ***
     
    *Generate a dummy variable to indicate when the treatment started:2006*
     
    gen time=(round>2006) &!missing(round)
     
    *Generate a dummy variable to identify the group exposed to treatment*
     
    gen treated =(birthstat==1 & sondum2==0)
    * Generate an interaction term between time and treated
     
    gen did=time*treated
    For the second model where the treatment is if a woman has had any additional children I am not quite sure how to generate my treatment variable (total child + any number of additional children).

    Any help with the code is greatly appreciated. Thanks.




Working...
X