Hello, I am new to this board so apologies if I don't yet know the proper etiquette for posting. I have found a couple questions posed that are similar to mine in nature, but none is quite what I am looking for. I don't want to waste anyone's time so if I have missed another solution please point me in the right direction and I will be happy to try those out! I am looking to find the total days overlapped between two drug classes throughout 1 year. There may be multiple periods of overlap throughout the year, however, I want to sum the total days of overlap into one final number. I would also like to include the first day of overlap. I have already broken my data down into years so each file is one complete year. Below is a simplified version of my data with what I currently 'have' and the output I 'want'. HAVE HAVE HAVE HAVE HAVE WANT WANT ID Year RxStart RxEnd DrugClass Overlap (days) 1st Day of Overlap 1 2009 17898 17928 0 30 17898 1 2009 17898 17928 1 30 17898 1 2009 18141 18171 0 30 17898 1 2009 18171 18201 0 30 17898 2 2009 18079 18115 1 15 18110 2 2009 18110 18140 0 15 18110 2 2009 18215 18230 1 15 18110 2 2009 18220 18234 0 15 18110 3 2009 18089 18125 0 0 . 3 2009 18126 18146 0 0 . 3 2009 18156 18186 1 0 . 3 2009 18186 18196 1 0 . Any and all help is appreciated! Thank you for your time.
... View more