BookmarkSubscribeRSS Feed
carl_miles
Fluorite | Level 6

Hi Folks, This is going to be big discussion, Keep focused and share your only usefull or helpfull ideas 

and It will be great help if could share the codes 
[Note: People who know how to text don't comment i don't want trash opinions in my post]

Rule 1: Line of therapy will be defined as all eligible treatments given within 28 days. The name of the “regimen” for that line of therapy is a combination of therapies in that line
Understanding of Rule 1: 

  1. The team will categorize regimens based on the first drug's start date + 28 days as the first line. Subsequently, the immediate drug start date + 28 days will be considered the second line, and so forth, continuing unless another Line of Therapy (LoT) rule intervenes.

Example: Records:

Patientid

Drug name

Start date

End date

Start date + 28

1001

A

1-Jan-24

15-Jan-24

29-Jan-24

1001

B

15-Jan-24

25-Jan-24

 

1001

C

1-Feb-24

15-Feb-24

29-Feb-24

1001

D

16-Feb-24

20-Feb-24

 

                         Transformed Records

Patientid

Drug name

Start date

End date

Line number

1001

A + B

1-Jan-24

25-Jan-24

1

1001

C + D

1-Feb-24

20-Feb-24

2

 

Rule 2: • CAR-T cellular therapy infusions always advance a line of therapy. Any treatment started within 14 days before CAR-T cell infusion as part of a conditioning regimen are ineligible for line of therapy. 
[Note: Before LoT development itself we will drop records which ever comes on or in between CAR-T start date - 14 days
We have two CAR-T drugs: Drug_B_A, Drug_UTC]
Understanding of Rule 2: 

  1. Records with start dates falling on or between CAR-T start date - 14 days before LoT development will be dropped.
  2. The team will advance the line if CAR-T is received within a 28-day interval or at any point unless it is start of 28 days interval. After advancing, drugs received on CAR-T start date + 28 days will be combined.
    Example: 

    Secenarion 1: where CAR-T comes later(second or latter) after the first drug start 28 days interval

     

    Patientid

    Drug_name

    Start date

    End date

    start date +28

     

    1001

    A

    1-Jan

    15-Feb

    29-Jan

     

    1001

    Drug_B_A

    20-Jan

    20-Jan

     

          
          
     

    Patientid

    Drug_name

    Start date

    End date

    Line number

     

    1001

    A

    1-Jan

    15-Feb

    1

     

    1001

    Drug_B_A

    20-Jan

    20-Jan

    2

Secenario 2: After Advancement CAR-T start date +28 will be one line

 

 

 

Patientid

Drug_name

Start date

End date

start date +28

 

1001

A

1-Jan

15-Feb

 

 

1001

Drug_UTC

20-Jan

20-Jan

17-Feb

 

1001

B

15-Feb

20-Feb

 

 

 

 

 

 

 

 

Patientid

Drug_name

Start date

End date

Line number

 

1001

A

1-Jan

15-Feb

1

 

1001

Drug_UTC + B

20-Jan

20-Feb

2


Rule 3: When an episode of Drug_RU, Drug_OB, and Drug_OF occurs one day before a new line-defining episode, the day of Drug_RU, Drug_OB, and Drug_OF episode is used as the start date for the new line
Understanding of the Rule: 

  1. The start date of Drug_RU, Drug_OB, and Drug_OF will be used as the new regimen start date if any of them precede the new line by one day.
    Example: 
    1. Records:

    Patientid

    Drug_name

    Start date

    End date

    start date +28

    1001

    A

    1-Jan-24

    15-Feb-24

    29-Jan-24

    1001

    B

    24-Jan-24

    29-Jan-24

     

    1001

    Drug_OB

    29-Jan-24

    15-Mar-24

     

    1001

    C

    30-Jan-24

    20-Mar-24

     

                             Transformed Records

    Patientid

    Drug name

    Start date

    End date

    Line number

    1001

    A+B

    1-Jan-24

    29-Jan-24

    1

    1001

    Drug_OB + C

    29-Jan-24

    20-Mar-24

    2


    Rule 4: Episodes of Drug_RU and Drug_RUH within 60 days of the line start date are included in that line
    Understanding of the Rule; The team will check after 28 day interval of one line the next immediate drugs is Drug_RU and Drug_RUH then we will combine it with the previous line 

    patientid

    drugname

    start_date

    end_date

    stdt_28

    stdt_60

    1001

    Drug_IX

    1-Dec-18

    1-Jan-19

    29-Dec-18

    30-Jan-19

    1001

    Drug_RU

    1-Dec-18

    1-Jan-19

     

     

    1001

    Drug_RU

    19-Jan-21

    20-Jan-21

     

     

    1001

    Drug_IX

    21-Jun-21

    23-Jun-21

     

     

    Transformed

     

     

     

     

     

    patientid

    drugname

    start_date

    end_date

    Line number

     

    1001

    Drug_IX, Drug_RU

    1-Dec-18

    20-Jan-21

    1   

     

    1001

    Drug_IX

    21-Jun-21

    23-Jun-21

    2   

     


    Advanced in line of therapy based on gaps
    Rule 5:
    If the gap is > 120 days from the previous end date to the subsequent start date, then the line will advance.
    Understanding the Rule 5:
    The team will advance the line irrespective of drugs if the gap greater than 120 days from the previous drug end date to the subsequent drug start date, then the line will advance else we would be combining the lines
    Example:

    Secenario - 1

    Different drugs

     

     

     

     

     

    Transformed

     

     

     

     

     

    Patientid

    Drug_name

    Start date

    End date

     

    Previous end date - subsequent start date

    Patientid

    Drug_name

    Start date

    End date

    Line_number

     

    1001

    A

    1-Jan-24

    15-Jan-24

     

    1/15/2024 - 05/15/2024

    1001

    A

    1-Jan

    15-Jan

    1

     

    1001

    B

    15-May-24

    25-May-24

     

    121

     

    1001

    B

    15-May

    25-May

    2

    Secenario - 2

    Same drugs retaining over the time

     

     

     

     

     

    Transformed

     

     

     

     

     

    Patientid

    Drug_name

    Start date

    End date

     

    Previous end date - subsequent start date

    Patientid

    Drug_name

    Start date

    End date

    Line_number

     

    1001

    A+B

    1-Jan-24

    15-Jan-24

     

    1/15/2024 - 02/01/2024

    1001

    A+B

    1-Jan

    25-May-24

    1

     

    1001

    A

    1-Feb-24

    25-May-24

     

    17

     

     

     

     

     

     


    Rule 6:
    For the following drugs, a gap of 90 days is required to advance the line: Drug_RU, Drug_RUH
    Understanding of Rule 6:
    If Drug_RU or Drug_RUH received at the end of 28 day interval of line definition then we will wcheck gap of the the previous line end date and subsequent start date is less than 90 days then bothe lines we will combine else we will separate it 
    Example 1:

    Patientid

    Drug_name

    Start date

    End date

    Start date  + 28

    Start date  + 60

    End date + 90

     

     

     

     

    1001

    A

    1-Jan-24

    20-Jan-24

    29-Jan-24

    1-Mar-24

     

     

     

     

     

    1001

    B

    10-Jan-24

    30-Jan-24

     

     

     

    40   

     

    Combine? A+ B + Ritu

    1001

    Drug_RU

    10-Mar-24

    25-May-24

     

     

    23-Aug-24

     

     

     

     

    Transformed A + B + Drug_RU as LINE 1

    Example 2: 

    Patientid

    Drug_name

    Start date

    End date

    Start date  + 28

    Start date  + 60

    End date + 90

    1001

    A

    1-Jan-24

    15-Jan-24

    29-Jan-24

    1-Mar-24

     

    1001

    Drug_RU

    15-Jan-24

    25-Jan-24

     

     

    24-Apr-24

    1001

    B

    26-Jan-24

    15-Feb-24

     

     

    15-May-24

    1001

    C

    15-Jul-24

    25-Jul-24

     

     

     

    1001

    D

    15-Oct-24

    20-Oct-24

     

     

     

    1001

    E

    17-Oct-24

    20-Oct-24

     

     

     


    Transform A +Drug_RU + B as line 1
    C as 2
    D + E as 3
    Its becoz Drug_RU is received in-between the 28 day interval and not as the last drug

    Rule 7: If the gap is ≤ 120 days from the previous end date to the subsequent start date, then the following will advance the line:
    7a. If the new agent overlaps with the line regimen, then the end of line is the last day before the initiation of the new agent.
    Understanding of Rule 7: 
    Example:

    Raw Records

     

     

     

     

    Patientid

    Drug_name

    Start date

    End date

    Start date  + 28

    Start date  + 60

    1001

    A

    1-Jan-24

    15-Jan-24

    29-Jan-24

    1-Mar-24

    1001

    B

    15-Jan-24

    25-Jan-24

     

     

    1001

    C

    31-Jan-24

    15-Feb-24

     

     

     

     

     

     

     

     

    Transform

     

     

     

     

     

    Patientid

    Drug_name

    Start date

    End date

    Line_number

     

    1001

    A +  B

    1-Jan-24

    25-Jan-24

    1

     

    1001

    C

    31-Jan-24

    15-Feb-24

    2

     



    7b. If the new agent does not overlap with the line regimen (i.e. discontinuation of all agents in line), then the end of the line is the end date of the last line agent. If only a single agent or portion of the total multi-drug regimen is discontinued, this is not considered a new LoT.
     

    Example;

    Records

     

     

     

     

    Patientid

    Drug_name

    Start date

    End date

    Start date  + 28

    Start date  + 60

    1001

    A

    1-Jan-24

    15-Jan-24

    29-Jan-24

    1-Mar-24

    1001

    B

    15-Jan-24

    25-Jan-24

     

     

    1001

    A

    1-Feb-24

    15-Feb-24

    29-Feb-24

     

    1001

    D

    16-Feb-24

    20-Feb-24

     

     

     

     

     

     

     

     

    Transform

     

     

     

     

     

    Patientid

    Drug_name

    Start date

    End date

    Line_number

     

    1001

    A +  B

    1-Jan-24

    15-Feb-24

    1

     

    1001

     D

    16-Feb-24

    20-Feb-24

    2

     

    Here the patient received Drug_A and Drug_B
    Later he dropped B 

    And contniued A 

    So A + B + A = A+B AS line 1
    D line 2

    Rule 8: The addition of Drug_LC, Drug_LLC, Drug_MS, or Drug_MTXT to another therapy does not advance the LOT
    Understanding of Rule 8:
    The team will not advance the line if the following drugs comes after line end: Drug_LC, Drug_LLC, Drug_MS, or Drug_MTXT. And If the mentioned drug dates are overlapping with the line of therapy, then it will be reported in that line and if dates are not overlapping then it will reported with the previous line of therapy. The mentioned drugs start date and end date will be not used to define line start and end dates
    Example:

    Table - 1

     

     

     

     

     

     

     

    Table - 2

     

     

     

     

     

     

    Patientid

    Drug_name

    Start date

    End date

    Start date  + 28

    Start date  + 60

     

     

    Patientid

    Drug_name

    Start date

    End date

    Start date  + 28

    Start date  + 60

    1001

    A

    1-Jan

    15-Jan

    29-Jan

    1-Mar

     

     

    1001

    A

    1-Jan

    15-Jan

    29-Jan

    1-Mar

     

    1001

    B

    15-Jan

    29-Jan

     

     

     

     

    1001

    B

    15-Jan

    29-Jan

     

     

     

    1001

    Drug_MS

    25-Jan

    25-Feb

     

     

     

     

    1001

    Drug_MS

    2-Feb

    10-Feb

     

     

     

    1001

    C

    1-Feb

    15-Feb

    29-Feb

     

     

     

    1001

    C

    11-Feb

    15-Feb

    10-Mar

     

     

    1001

    D

    16-Feb

    20-Feb

     

     

     

     

    1001

    D

    16-Feb

    20-Feb

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    final

     

     

     

     

     

     

     

    final

     

     

     

     

     

     

    Patientid

    Drug_name

    Start date

    End date

    Line _number

     

     

     

    Patientid

    Drug_name

    Start date

    End date

     

     

     

    1001

    A + B + Drug_MS

    1-Jan

    29-Jan

    1

     

     

     

    1001

    A + B  + Drug_MS

    1-Jan

    29-Jan

    1

     

     

    1001

    C + D + Drug_MS

    1-Feb

    20-Feb

    2

     

     

     

    1001

    C + D

    11-Feb

    20-Feb

    2

     

     



    I want to combine all the Rules and code for it 
    Even ideas and approching ways and  base code something like that also will be usefull if you share it 
    So guys kindly comment IF you can't understand any rules 

    KIndly help me out 



1 REPLY 1
ballardw
Super User

First useful and possibly quite critical comment:

 

Provide some example data in the form of a working data step posted in a text box. The data should be typical of what you have. The working data step is so we understand your data. For instance, with some "table" copied from a word processor or spreadsheet we cannot tell which of your variables are numeric or text, whether your "dates" are proper SAS date values or character. This a an extremely critical bit when doing any manipulation related to date manipulation as otherwise the first step is to create actual date values.

 

Second, make sure you are consistent internally in your description, use VARIABLE names (see first comment about data step). You start with " therapy will be defined as all eligible treatments ". Since there is no column or variable indicated as having a name of Treatment then we are left guessing what that actually means. Same with "Line of Therapy (LoT)", not clearly defined. Other instances of not defined, please fix them. There is nothing shown that identifies what a "CAR-T" is.

 

Third, since there may be some order dependence going on is a "Drug_A_B" actually different than a "Drug_B_A" value in later processing?

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 316 views
  • 0 likes
  • 2 in conversation