04-23-2014 01:06 PM
I have to ultimately code for medication discontinuation, intensification, and switching, but I'm stuck on even how to start this...
Here is a snippet of my dataset:
My data goes for 9 years and the patients can be on a potential of 11 drugs (however, I don't beleive anyone reaches that amount in the data). I've already taken those patients who had a medication days_supply <30 (since I don't find that to be clinically relevent). Now I would like to start coding for discontinuation (i'm thinking another column that will be binary), based on these rules: no evidence of a drug for >=180 consecutive days. so, for example, drug 2 is discontinued in the first patient starting on 3-4-2003.
any ideas on how to go about this?
04-23-2014 01:45 PM
It depends on which date you assume for the calculation of drug discontinuation.
input pat_id start_date :anydtdte. end_date :anydtdte. drug;
format start_date end_date yymmdd.;
43 2-Dec-03 1-Mar-04 1
43 3-Feb-04 3-May-03 1
43 11-Jun-04 9-Sep-04 1
43 16-Sep-04 15-Dec-04 1
43 4-Dec-02 4-Mar-03 2
51 4-Oct-10 2-Jan-11 1
51 20-Nov-02 18-Feb-03 1
51 1-Feb-03 2-May-03 2
51 17-Dec-02 24-Dec-02 2
51 31-Jan-03 1-May-03 3
51 4-Oct-10 2-Jan-11 3
/* Effective date for discontinuation calculation */
/* Or */
create table have1 as
select *, intck("DAY", max(end_date), &currDate.) > 180 as discont
group by pat_id, drug;
select * from have1;
04-24-2014 02:15 PM
Thank you for your reply, I have to questions in response:
1.) How did you know to choose 1/1/2005 as the current date? is this arbitrary?
2.) The code worked, however I'm needing it to do more...if I arrange the medication by patient in accordance to when they start their medicine (example below), there's gaps in medication use that aren't being captured with this code. For example if you look at patient 1, they are showing no medicine from 4-mar-2003 to 2-dec-2003, which is a gap in all meds of 273 days. how do I account for this? thanks much!
04-24-2014 03:09 PM
Take some time to define how you want your output data to look like and all potential edge cases. It's much easier to get where you want to go and much easier to make suggestions. The way your question is currently formulated we'll have to guess at outputs, as well as it's restricted to people who have dealt with this exact scenario. If you phrase it in terms of a programming problem you'll get better responses.