Hi,
I am using a large claims database to look at the costs of a procedure (ERCP) and compare the costs among those patients with and without an adverse event called post-ercp pancreatitis (PEP). Patients can have ERCPs and PEP more than once and I am struggling with how to capture 30-day events when a patient has multiple procedures. I was using by enrolid : replace date_bil_alt_ = date_bil_alt_[_n-1] if date_bil_alt_ == . to fill in any missing ERCP date observations so I can identify claims occuring in 30 days and bys enrolid date_bil_alt: replace pep_date = pep_date[_n-1] if pep_date == . to fill in any missing dates of post-ERCP pancreatitis. However, what was happening is that I am not capturing all 30 days if someone has multiple ERCPs or multiple episodes of PEP (example below). My coding will only identify up to their next procedure and I am missing costs. Any suggestions on how I could organize this would be helpful.
Thank you
----------------------- copy starting from the next line -----------------------
I am using a large claims database to look at the costs of a procedure (ERCP) and compare the costs among those patients with and without an adverse event called post-ercp pancreatitis (PEP). Patients can have ERCPs and PEP more than once and I am struggling with how to capture 30-day events when a patient has multiple procedures. I was using by enrolid : replace date_bil_alt_ = date_bil_alt_[_n-1] if date_bil_alt_ == . to fill in any missing ERCP date observations so I can identify claims occuring in 30 days and bys enrolid date_bil_alt: replace pep_date = pep_date[_n-1] if pep_date == . to fill in any missing dates of post-ERCP pancreatitis. However, what was happening is that I am not capturing all 30 days if someone has multiple ERCPs or multiple episodes of PEP (example below). My coding will only identify up to their next procedure and I am missing costs. Any suggestions on how I could organize this would be helpful.
Thank you
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double enrolid float(svcdate date_bil_alt pep_date) 38501 21640 . . 38501 21641 21641 . 38501 21641 21641 . 38501 21641 21641 . 38501 21641 21641 . 38501 21641 21641 . 38501 21641 21641 . 38501 21641 21641 . 38501 21642 21641 . 38501 21642 21641 21642 38501 21643 21641 . 38501 21649 21641 . 38501 21650 21641 . 38501 21651 21641 . 38501 21651 21641 . 38501 21651 21641 . 38501 21651 21641 . 38501 21651 21641 . 38501 21656 21641 . 38501 21656 21641 . 38501 21656 21641 . 38501 21661 21641 . 38501 21666 21641 . 38501 21666 21641 . 38501 21666 21641 . 38501 21666 21641 . 38501 21666 21641 . 38501 21666 21641 . 38501 21666 21641 . 38501 21666 21641 . 38501 21666 21641 . 38501 21666 21641 . 38501 21666 21641 . 38501 21666 21641 . 38501 21666 21641 . 38501 21666 21641 . 38501 21666 21641 . 38501 21666 21641 . 38501 21667 21641 . 38501 21667 21641 . 38501 21668 21641 . 38501 21668 21641 . 38501 21668 21641 . 38501 21668 21641 . 38501 21668 21641 . 38501 21669 21641 . 38501 21669 21641 . 38501 21669 21641 . 38501 21669 21641 . 38501 21669 21641 . 38501 21670 21641 . 38501 21670 21641 . 38501 21672 21641 . 38501 21675 21675 . 38501 21675 21675 . 38501 21675 21675 . 38501 21675 21675 . 38501 21675 21675 . 38501 21675 21675 . 38501 21675 21675 . 38501 21675 21675 . 38501 21675 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 21676 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21676 21675 . 38501 21677 21675 . 38501 21677 21675 . 38501 21677 21675 . 38501 21678 21678 . 38501 21678 21678 . 38501 21678 21678 . 38501 21678 21678 . 38501 21678 21678 . 38501 21678 21678 . 38501 21679 21678 . 38501 21679 21678 . 38501 21680 21678 . 38501 21681 21678 . 38501 21681 21678 . 38501 21682 21678 . 38501 21682 21678 . 38501 21683 21678 . 38501 21683 21678 . 38501 21684 21678 . end format %td svcdate format %td date_bil_alt format %td pep_date
Comment