Announcement

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

  • Panel Data: How to create dummy for first period for individuals that were treated later (graphic included)?

    Hello everybody,

    I really hope someone could help me because I am stuck in a problem. I have a panel data set where each individual has two observations, one for 2015 and one for 2016. There is a Group of individuals that are eligible for a health program (let's call them the Eligibles). A few of these Eligibles get treated in 2016 such that the treatment dummy =1 if the person was treated in 2016. As no one was treated in 2015, the treatment dummy is always 0 in 2015.

    Now I want to create a binary variable that shows me the individual in 2015, that was treated in 2016 such that I can compare the Eligibles in 2015 that were not treated with the Eligibles in 2015 that were later treated. Once I would have this binary variable I could do balance tests and check whether the Eligible & Not-treated and the Eligible & Treated share the same characteristics and are not significantly different from each other. (Control Group: Eligible & Not-treated, Treatment Group: Eligible & Treated)

    Has anyone an idea how I can create this dummy for the year 2015 that differentiates between someone who was treated the period later and someone who was not?

    Here is an easy explanation/example once again how I would want to create it:
    Click image for larger version

Name:	Dummy_for_Treatment.PNG
Views:	1
Size:	6.2 KB
ID:	1680085



    I want to create the orange-ish column in order to see that Eligible 1, 4 & 5 were treated in 2016 (=treatment group) and Eligible 2 & 3 were not treated even though they would have been eligible for the program (=control group). The white columns are already given in the dataset.

    As I am very new to STATA, it would be great if you could explain it to me the easiest way possible.

    I would be really thankful for your support!! ♥
    Last edited by Maria Passau; 31 Aug 2022, 05:04.

  • #2
    Maria:
    you may want to try:
    Code:
    bysort ID: gen wanted=1 if Treated[1]==0 &  Treated[2]==1
    bysort ID: replace wanted=0 if Treated[1]==0 &  Treated[2]==0
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hello Carlo,

      thank you so much for your help!! It indeed solved all my problems now. Thank you!

      All the best
      Maria

      Comment

      Working...
      X