Thank you! This worked great! Only thing is, I left something out. I have to define: new patients and returning patients. Those that you helped me with are neither new or returning. They have an admission with no discharge, therefore they're still receiving services in some program. The problem I'm running into is, if I use the merge technique, it overrides some of my defined returning patients. So for example, Patient 1 is a return patient when they're admitted on 7/1/2021, but it's flagged as a neither. Your technique helped me with Patient 2, as using lag does not work for that one (note: the patient was admitted on 7/10/20 - prior to their discharge date on 11/10/20 - that's why this patient is considered neither a new or retuning patient). Do you know of a way to fix this issue?
Date___Admit | Date___Discharge | ID___Patient | n | WANT |
9/27/2019 | 1/10/2020 | 1 | 1 | First_Time |
1/28/2021 | 4/27/2021 | 1 | 2 | Return |
7/1/2021 | . | 1 | 3 | Return |
7/13/2021 | . | 1 | 4 | . |
| | | | |
7/2/2020 | 11/10/2020 | 2 | 1 | First_Time |
7/13/2020 | 4/6/2021 | 2 | 2 | . |
10/22/2020 | . | 2 | 3 | . |
11/10/2020 | 3/31/2021 | 2 | 4 | . |
5/26/2021 | . | 2 | 5 | . |