BookmarkSubscribeRSS Feed
jcooper3
Calcite | Level 5

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:

pat_idstart_dateend_datedrug
432-Dec-031-Mar-041
433-Feb-043-May-031
4311-Jun-049-Sep-041
4316-Sep-0415-Dec-041
434-Dec-024-Mar-032
514-Oct-102-Jan-111
5120-Nov-0218-Feb-031
511-Feb-032-May-032
5117-Dec-0224-Dec-022
5131-Jan-031-May-033
514-Oct-102-Jan-113

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?

thanks!

-

3 REPLIES 3
PGStats
Opal | Level 21

It depends on which date you assume for the calculation of drug discontinuation.

data have;

input pat_id start_date :anydtdte. end_date :anydtdte. drug;

format start_date end_date yymmdd.;

datalines;

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 */

%let currDate=today();

/* Or */

%let currDate='01JAN2005'd;

proc sql;

create table have1 as

select *, intck("DAY", max(end_date), &currDate.) > 180 as discont

from have

group by pat_id, drug;

select * from have1;

quit;


PG

PG
jcooper3
Calcite | Level 5

Hi PGstats,

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!

pat_idstart_dateend_datedrug
43

18-nov-02

16-feb-031
434-dec-024-mar-032
432-dec-031-mar-041
433-feb-043-may-041
4311-jun-049-sep-041
5120-nov-0218-feb-031
5117-dec-0224-dec-021
5131-jan-031-may-032
511-feb-032-may-032
514-oct-102-jan-113
514-oct-102-Jan-113
Reeza
Super User

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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1033 views
  • 3 likes
  • 3 in conversation