Hello all,
Thanks to Joseph Coveney's help, I was able to put my data in the following format. Then I merged it with "visits" data.
Now I have over 20K of data in the following format.
I want to determine if the visit_date is within any of the auth_begdate and auth_enddate pairs and put a "Y" or "N" as follows:
My searches for a command or code did not get me closer to a solution.
I thought of two forvalues loops, the outer loop to go through each of the 20K lines, and the inner loop to evaluate if the visit_date falls within the beginning and end dates. (I have from one to eight pairs of dates for each person.)
Any hints would be much appreciated.
Thanks!
Artur
Thanks to Joseph Coveney's help, I was able to put my data in the following format. Then I merged it with "visits" data.
Now I have over 20K of data in the following format.
ln4fn4dob | pat_lname | pat_fname | visit_date | auth_begdate_1 | auth_enddate_1 | auth_begdate_2 | auth_enddate_2 | auth_begdate_3 | auth_enddate_3 | LineNo |
abralily27590 | Abramson | Lily | 1/30/2022 | 1/1/2022 | 1/31/2022 | 2/6/2022 | 3/8/2022 | - | - | 1 |
abralily27590 | Abramson | Lily | 2/1/2022 | 1/1/2022 | 1/31/2022 | 2/6/2022 | 3/8/2022 | - | - | 1 |
ln4fn4dob | pat_lname | pat_fname | visit_date | auth_begdate_1 | auth_enddate_1 | auth_begdate_2 | auth_enddate_2 | auth_begdate_3 | auth_enddate_3 | LineNo | Authorized |
abralily27590 | Abramson | Lily | 1/30/2022 | 1/1/2022 | 1/31/2022 | 2/6/2022 | 3/8/2022 | - | - | 1 | Y |
abralily27590 | Abramson | Lily | 2/1/2022 | 1/1/2022 | 1/31/2022 | 2/6/2022 | 3/8/2022 | - | - | 1 | N |
I thought of two forvalues loops, the outer loop to go through each of the 20K lines, and the inner loop to evaluate if the visit_date falls within the beginning and end dates. (I have from one to eight pairs of dates for each person.)
Any hints would be much appreciated.
Thanks!
Artur
Comment