I need to perform some difference in differences analysis on some panel data. I need to create a control group and a treatment group. The panel data consists of two waves (a 2019 and 2020). The treatment group are those whose second wave interview occurred on or after march 2nd 2020.
I use the command:
gen treatment=0
replace treatment = 1 if date >= 21976
Date is the variable showing the date of their interview and 21976 is the Stata code for march 2nd 2020. treatment is to be a dummy, 1 for the treatment group and 0 for the control group.
This makes the observations in wave 2 equal zero for the control group and 1 for the treatment group.
What I need to do is tell Stata that the individuals for which treatment = 1 in wave 2, make treatment equal 1 in wave 1
I've been told that the bysort command will be useful for this task. But after searching online for hours I haven't been able to find anything to help me do this task.
Any help is much appreciated because I'm at the end of my rope trying to solve this
I use the command:
gen treatment=0
replace treatment = 1 if date >= 21976
Date is the variable showing the date of their interview and 21976 is the Stata code for march 2nd 2020. treatment is to be a dummy, 1 for the treatment group and 0 for the control group.
This makes the observations in wave 2 equal zero for the control group and 1 for the treatment group.
What I need to do is tell Stata that the individuals for which treatment = 1 in wave 2, make treatment equal 1 in wave 1
I've been told that the bysort command will be useful for this task. But after searching online for hours I haven't been able to find anything to help me do this task.
Any help is much appreciated because I'm at the end of my rope trying to solve this
Comment