I am fairly new to stata, and have run into a predicament in my data management. I am dealing with data concerning prescriptions of medicine. I have the date for when the prescriptions was handed out, then i extrapolated the date for when the prescriptions would run out. To get a measurement of risk time. I have thanks to earlier queries managed to get these two dates on separate lines(observations). I have made a variable(drug status) indicating the date is a date for picking up a prescription(1) and when the date is marking that the prescription has run out (0).
My problem lies in that I have overlaps due to patients picking up prescriptions before I estimated that they would have. an example is of my data is as follows:
id | date | drug status |
1 | 01jan2010 | 1 |
1 | 03jan2010 | 1 |
1 | 04jan2010 | 0 |
1 | 06jan2010 | 0 |
The problem with this is that I fear in the analysis I plan to do, this would be wrongly interpreted as the patient being without drugs from 04jan2010 to 06jan2010, when this is not the case.
I seek code that would:
1. delete and observation if the drug status is 1 if drug status is 1 in the previous observation
2. and delete and observation if the drug status is 0 if the drug status is 0 in the following observation.
sincerely
Henrik Sandager
0 Response to Getting rid of overlaps
Post a Comment