Apprectiate your advise
I have a dataset where i need new flag variable for sequential or combination therapy
Patient
Treatment
Start
End
Flag
E1
A
10-Apr-17
26-Jun-17
Seq
A
E1
B
07-Jun-18
08-Aug-18
Seq
A
E2
B
06-Sep-16
20-Oct-16
Seq
B
E2
A
15-Nov-17
04-Oct-18
Seq
B
E3
A
07-Dec-10
08-Feb-11
Seq
A
E3
A
06-Sep-16
20-Oct-16
Seq
A
E3
B
15-Nov-17
04-Oct-18
Seq
A
E4
B
07-Dec-10
08-Feb-11
Seq
B
E4
B
06-Sep-16
20-Oct-16
Seq
B
E4
A
15-Nov-17
04-Oct-18
Seq
B
E5
A
27-Feb-18
20-Nov-18
Combi
C
E5
B
22-May-18
30-Oct-18
Combi
C
E7
A
01-Feb-16
28-Apr-16
Seq
A
E7
A
20-Apr-17
16-May-17
Seq
A
E7
B
21-Aug-17
02-Jan-19
Seq
A
E7
A
27-May-19
29-Jul-19
Seq
A
E8
B
01-Feb-16
28-Apr-16
Seq
B
E8
B
20-Apr-17
16-May-17
Seq
B
E8
A
21-Aug-17
02-Jan-19
Seq
B
E8
B
27-May-19
29-Jul-19
Seq
B
treatment can be sequential (prev trt has ended before start of next trt) treatment can be combination (prev trt has not ended before start of next trt)
If the patient has an end date for one prior therapy that occurs on or before the start date of another prior therapy, then assign A or B depending on which starts first Ex: scenarios 1,2,3 and 4
If the patient doesn’t have an end date for a prior therapy that occurs on or before the start date of another prior therapy, then assign C. Ex: scenario 5
Also, For scenarios 3 and 4, we take the min (start) and max (end) per treatment for comparing. For Ex: Patient E3, A trt has min (start) as 07-Dec-10 and max (end) as 20-Oct-16 which has ended before min(start) of B (15-Nov-17)
However scenarios 5 and 6 we need to make few exceptions.
when we take the min (start) and max (end) per treatment, they get flagged as combination although they are sequential For Ex: Patient E7, A trt has min (start) as 01-Feb-16 and max (end) as 29-Jul-19. So when code compares Trt A max(end) 29-Jul-19 with Trt B min(start) 21-Aug-17, it treats as A has not ended before start of B and hence flags as Combination.
Similar for Patient E8.
How to tell the program to make an exception and not count this as combination? It should be treated as sequential
Similar exceptions should be made for A B B A, A B B A A etc
... View more