Hello!, I would like to start thanking you all for replying the questions in this forum, for someone new in Stata like me, it has been extremely helpful.
Now, I have come across with this issue which, unfortunately, i haven't found a solution, so, here it goes my first post in this forum.
I have this data (example):
ID |
D of Program Enrollment |
Intervention |
... |
... |
... |
43 |
01-Aug-16 |
|
44 |
01-Sept-16 |
|
45 |
01-Dec-16 |
|
46 |
01-Jan-17 |
1 |
47 |
01-March-17 |
1 |
48 |
31-Dec-17 |
1 |
49 |
01-Jan-18 |
|
50 |
05-Jan-18 |
|
51 |
08-Nov-18 |
|
... |
... |
... |
A cohort of patients at my hospital were recruited for an intervention from dates 01-Jan-17 to 31-Dec-17 ("1" for intervention). Now, for my study, i would like to create a control group ("0" for no intervention) for this intervention group in a way that i can minimize the possibility of temporal bias when comparing them. That is why i would like Stata to do the following: For example, from 01-Dec-16 (patient "id" number "45") to 01-Jan-17 (initial date of intervention recruitment period) there is 31 days apart, and from 31-Dec-17(final date of intervention recruitment period) to 01-Jan-18 there is 1 day apart. So, the first "0" in the "Intervention" variable should go to "id" number "49". Then, patient "id" number "49" is 6 days apart from 31-Dec-17, which is an interval still shorter than 31 days (the one calculated from the date of patient 45 to the initial date of recruitment period), so the 2nd "0" in the variable intervention should go to patient "id" number "50". Then patient "id" number "51" is +10 months apart from final date of intervention recruitment period, which is an interval much more larger compared to the 31 days apart calculated from patient "id" number "45", so the 3rd "0" should go to patient "id" number "45".
So if i just wanted to create a control group of 3 participants, i would have the following table
ID |
Date of Program Enrollment |
Intervention |
... |
... |
... |
43 |
01-Aug-16 |
|
44 |
01-Sept-16 |
|
45 |
01-Dec-16 |
0 |
46 |
01-Jan-17 |
1 |
47 |
01-March-17 |
1 |
48 |
31-Dec-17 |
1 |
49 |
01-Jan-18 |
0 |
50 |
05-Jan-18 |
0 |
51 |
08-Nov-18 |
|
... |
... |
... |
In my real data, my intervention group is 80 "1s" and im choosing 4 control members per each intervened subject (so i have to run this method until i get 320 "0s".
I truly dont know if there is a way to do this automatically or else i have to do it one by one by checking the difference between dates for each observation.
Thank you for your help in advance!,
Rodrigo C.
0 Response to Creating a control group using dates to minimize temporal bias
Post a Comment