Hello,
I am having an issue with my data. To explain it in simple language, I have created a simple example data set here:
Here I have a panel data set on five families and from year 2000 to 2002. Now, I have the year when they have their first kid. Now I want to run an event study analysis, where I have to create leads and lags period for the families after and from having the first kid. Therefore, I need to create time to treat variable. Like this:
Can anyone please help me with the codes here? Also, what should I do with the families (like families 2 & 3) for whom the event of having kids never occurs.
Thank you!
I am having an issue with my data. To explain it in simple language, I have created a simple example data set here:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(Family_id Year had_new_kid) 1 2000 . 2 2000 . 3 2000 . 4 2000 2000 5 2000 . 1 2001 2001 2 2001 . 3 2001 . 4 2001 . 5 2001 . 1 2002 . 2 2002 . 3 2002 . 4 2002 . 5 2002 2002 end
Here I have a panel data set on five families and from year 2000 to 2002. Now, I have the year when they have their first kid. Now I want to run an event study analysis, where I have to create leads and lags period for the families after and from having the first kid. Therefore, I need to create time to treat variable. Like this:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(Family_id Year had_new_kid time_to_treat) 1 2000 . 2001 2 2000 . . 3 2000 . . 4 2000 2000 2000 5 2000 . 2002 1 2001 2001 2001 2 2001 . . 3 2001 . . 4 2001 . 2000 5 2001 . 2002 1 2002 . 2001 2 2002 . . 3 2002 . . 4 2002 . 2000 5 2002 2002 2002 end
Thank you!
Comment