Thanks Jim!! I want to report type (A,A or A,B, or B,B) within overlaps. Id, continuous days, types overlapped 1 12 A,B My job is to check if (1) there are two different drugs overlap >5 days within type a, (2) if it happens between type a and type b, and/or (3) if it happens within type b. Specifically, if the data is the following (please use the following data). I need get the result showing there are (1) drugs overlap for type a and (2) drugs overlap between type a and b for id=1, and drugs overlap for type a for id=2, like the following. result: Id, continuous days, types overlapped 1 XXX a,a 1 XXX a,b 2 XXX a,a data: id type drug begin_date end_date 1 a drug1 03/01/14 03/10/14 1 a drug1 03/11/14 03/20/14 1 a drug1 03/25/14 04/05/14 1 a drug2 03/02/14 03/09/14 1 a drug2 03/17/14 03/24/14 1 a drug2 03/27/14 04/04/14 1 a drug3 09/02/14 09/09/14 1 b drug4 03/01/14 03/10/14 1 b drug4 03/11/14 03/20/14 1 b drug4 03/25/14 04/05/14 1 b drug5 09/02/14 09/09/14 2 a drug1 03/01/14 03/10/14 2 a drug1 03/11/14 03/20/14 2 a drug1 03/25/14 04/05/14 2 a drug2 03/02/14 03/09/14 2 a drug2 03/17/14 03/24/14 2 a drug2 03/27/14 04/04/14 2 a drug3 09/02/14 09/09/14 Thanks so much in advance for your time and your answer!!!
... View more