I have two sets of data, one from a satellite hospital and the other from Central hospital.
I have to find occurrences where a patient has been discharged from the satellite hospital and admitted to the central hospital within three days.
I have three columns of data, (A to C and D to F) national ID, patient # and date of discharge or admission.
I have to take the national ID in column A, find a match in column D and calculate if the date in column F is three days or less than three days apart. So if a patient is discharged on October 1, and admitted by October 4th I have a match. If admitted before October 1 or after October 4th, it is not a match.
I have to find each pair and either put them in new columns to show the pairs.
A patient could be discharged more than once and a patient could be admitted more than once.
In the sample below the second and the sixth rows in column A would form a match with the third and the seventh row in column D
Thanks to all
I have to find occurrences where a patient has been discharged from the satellite hospital and admitted to the central hospital within three days.
I have three columns of data, (A to C and D to F) national ID, patient # and date of discharge or admission.
I have to take the national ID in column A, find a match in column D and calculate if the date in column F is three days or less than three days apart. So if a patient is discharged on October 1, and admitted by October 4th I have a match. If admitted before October 1 or after October 4th, it is not a match.
I have to find each pair and either put them in new columns to show the pairs.
A patient could be discharged more than once and a patient could be admitted more than once.
In the sample below the second and the sixth rows in column A would form a match with the third and the seventh row in column D
Thanks to all
Code:
Satellite Centrai
National ID Patient Acct Date National ID Patient Acct Date
28036 137508 5/29/2013 26777 14231035 2/28/2013
28036 312770 9/16/2013 54567 15148497 4/10/2013
42722 501921 9/16/2013 28036 21974999 9/17/2013
44649 614901 2/17/2013 28036 22747589 9/10/2013
74889 499947 11/19/2012 28036 22837406 6/5/2013
74889 720575 7/11/2013 44649 27225653 1/3/2013
74889 598366 7/22/2013 74889 27915706 7/14/2013
85510 332934 7/1/2013 74889 27977996 10/9/2013
85510 613532 8/15/2013 74889 32786163 7/2/2013
89517 482967 7/1/2013 14345 62566514
5/29/2013