BookmarkSubscribeRSS Feed
mgrzyb1
Calcite | Level 5

I am facing a problem in formulating an efficient SAS algorithm to capture combination therapy for patients would be really appreciated if we can get some help regarding the same.

The problem is defined below:
We have data where a patient has evidence of having taken 4 different drug classes in a specified period. (Each column is the start and end date of only 1 drug class.) (We have built episodes spanning the duration for which each drug class was taken by the patient.)


They are given in the form of epi_start1 and epi_end1 (that is the start and end of drug class 1) and 3 more such pairs of start and end dates for drug classes 2, 3 and 4 respectively.

A patient is classified as taking quadruple therapy if all 4 drugs were taken together for at least 14 days.
/

But if a patient has overlapping days of supply of at least 14 days between 3 out of the 4 drugs then the patient is classified as taking triple therapy of the three overlapping drug classes only if the 4th drug class is not starting later than the triple therapy combination. If the 4th drug is starting later then it is classified as monotherapy of drug 4.


Similarly, if there is an overlap of at least 14 days between 2 of the 4 drugs then it is a dual therapy of those two drugs only if the third or fourth does not lie after the start of the dual therapy. Else it is monotherapy of latest drug.

Moreover, if the patient takes two different sets of dual therapy in this period (i.e., together for at least 14 days but not simultaneously) then the patient must be classified as taking the later dual therapy.

The sample data set and illustration of the same is attached herewith for your reference. This dataset does not have actual patient IDs. I only included 25 patients for help.

 

One of the documents attached is a pictoral of the timing and details.

 

Please help me. 

3 REPLIES 3
mgrzyb1
Calcite | Level 5
I forgot to include the sample dataset.
mgrzyb1
Calcite | Level 5

Here is the sample data. 

Reeza
Super User

I've modified your subject line to be more descriptive - this way other uses can more easily decide if this question is within their skillsets or interest. Please use more descriptive titles in the future. 

 

Can you also include the expected output for those 25 records? Otherwise it's hard to know if the code is correct or not and this would reduce the back and forth for clarifications or code modifications. 

 


@mgrzyb1 wrote:

I am facing a problem in formulating an efficient SAS algorithm to capture combination therapy for patients would be really appreciated if we can get some help regarding the same.

The problem is defined below:
We have data where a patient has evidence of having taken 4 different drug classes in a specified period. (Each column is the start and end date of only 1 drug class.) (We have built episodes spanning the duration for which each drug class was taken by the patient.)


They are given in the form of epi_start1 and epi_end1 (that is the start and end of drug class 1) and 3 more such pairs of start and end dates for drug classes 2, 3 and 4 respectively.

A patient is classified as taking quadruple therapy if all 4 drugs were taken together for at least 14 days.
/

But if a patient has overlapping days of supply of at least 14 days between 3 out of the 4 drugs then the patient is classified as taking triple therapy of the three overlapping drug classes only if the 4th drug class is not starting later than the triple therapy combination. If the 4th drug is starting later then it is classified as monotherapy of drug 4.


Similarly, if there is an overlap of at least 14 days between 2 of the 4 drugs then it is a dual therapy of those two drugs only if the third or fourth does not lie after the start of the dual therapy. Else it is monotherapy of latest drug.

Moreover, if the patient takes two different sets of dual therapy in this period (i.e., together for at least 14 days but not simultaneously) then the patient must be classified as taking the later dual therapy.

The sample data set and illustration of the same is attached herewith for your reference. This dataset does not have actual patient IDs. I only included 25 patients for help.

 

One of the documents attached is a pictoral of the timing and details.

 

Please help me. 


 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1352 views
  • 0 likes
  • 2 in conversation