Hello,
I have panel data where each row represents a different prescription for a patient. A simplified example is below (end_supply = start_supply + prescription coverage). I need to identify all combination treatments that occur during overlapping time periods, and eventually I would also need to identify treatment lines (where patients may switch to another combo to another). But my first priority would be to identify the combination treatments and I am currently stumped. Is there an easy way to do this? Thank you in advance!
I have panel data where each row represents a different prescription for a patient. A simplified example is below (end_supply = start_supply + prescription coverage). I need to identify all combination treatments that occur during overlapping time periods, and eventually I would also need to identify treatment lines (where patients may switch to another combo to another). But my first priority would be to identify the combination treatments and I am currently stumped. Is there an easy way to do this? Thank you in advance!
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(patient_id pres_coverage prescript_date) str17 treatment_name float(start_supply end_supply) 1 29.85 21422 "Retinoids" 21422 21522 1 5 21422 "Acitretin" 21422 21522 1 30 21429 "Acitretin" 21429 21529 1 100 21462 "Retinoids" 21462 21562 1 30 21476 "Acitretin" 21476 21576 1 16.667 21489 "Retinoids" 21489 21589 1 30 21489 "Acitretin" 21489 21589 2 100 21344 "Retinoids" 21344 21444 2 100 21344 "Urea" 21344 21444 2 100 21400 "Retinoids" 21400 21500 2 100 21400 "Urea" 21400 21500 2 7 21449 "Antibiotics" 21449 21549 2 100 21656 "Retinoids" 21656 21756 2 28.039 21656 "Adalimumab" 21656 21756 3 100 21103 "Retinoids" 21103 21203 3 100 21114 "Retinoids" 21114 21214 3 100 21141 "Retinoids" 21141 21241 3 100 21159 "Retinoids" 21159 21259 3 15 21169 "Acitretin" 21169 21269 3 100 21169 "Retinoids" 21169 21269 3 100 21203 "Retinoids" 21203 21303 4 100 21180 "Retinoids" 21180 21280 4 40 21180 "Retinoids" 21180 21280 4 5 21180 "Antibiotics" 21180 21280 4 100 21264 "Retinoids" 21264 21364 4 40 21264 "Retinoids" 21264 21364 4 100 21316 "Retinoids" 21316 21416 4 53.333 21316 "Retinoids" 21316 21416 5 100 20924 "Retinoids" 20924 21024 5 12 20936 "Antibiotics" 20936 21036 5 40 20984 "Retinoids" 20984 21084 5 66.667 20984 "Retinoids" 20984 21084 5 66.667 21015 "Retinoids" 21015 21115 5 93.545 21033 "Retinoids" 21033 21133 5 100 21048 "Retinoids" 21048 21148 6 25 21568 "Retinoids" 21568 21668 6 15 21637 "Acitretin" 21637 21737 6 50 21652 "Retinoids" 21652 21752 6 50 21652 "Retinoids" 21652 21752 6 50 21673 "Retinoids" 21673 21773 6 50 21701 "Retinoids" 21701 21801 6 50 21754 "Retinoids" 21754 21854 7 20 21343 "Ciclosporin" 21343 21443 7 100 21379 "Retinoids" 21379 21479 7 20 21379 "Ciclosporin" 21379 21479 7 20 21439 "Ciclosporin" 21439 21539 7 20 21491 "Ciclosporin" 21491 21591 7 100 21491 "Retinoids" 21491 21591 7 100 21631 "Retinoids" 21631 21731 8 200 21436 "Retinoids" 21436 21536 8 100 21436 "Pimecrolimus" 21436 21536 8 100 21436 "Urea" 21436 21536 8 50 21468 "Retinoids" 21468 21568 8 25 21468 "Urea" 21468 21568 8 200 21581 "Retinoids" 21581 21681 8 200 21600 "Retinoids" 21600 21700 9 100 21575 "Retinoids" 21575 21675 9 6.667 21604 "Antibiotics" 21604 21704 9 28.039 21926 "Adalimumab" 21926 22026 9 84.116 21929 "Adalimumab" 21929 22029 9 84.116 22090 "Adalimumab" 22090 22190 9 15 22193 "Acitretin" 22193 22293 9 84.116 22212 "Adalimumab" 22212 22312 10 66.667 21447 "Retinoids" 21447 21547 10 33.333 21447 "Urea" 21447 21547 10 33.333 21523 "Urea" 21523 21623 10 28.571 21526 "Adalimumab" 21526 21626 10 85.714 21532 "Adalimumab" 21532 21632 10 84.116 21624 "Adalimumab" 21624 21724 10 50 21709 "Pimecrolimus" 21709 21809 end format %td prescript_date format %td start_supply format %td end_supply
Comment