Hi,
I have a set of patients and their encounters at different hospitals. So, each patient may have visited different hospitals. So, I want to assign one hospital to each patient based on majority of their visits in the hospital. Some hospital info may be missing. For example-
if a patient have 2, 3 and 4 visits in A, B and C hospital respectively, then C will be assigned to this patient as his hospital as the patient visited C for most of the times.
if a patient have 2, 4 and 4 visits in A, D and E hospital respectively, then D or E(any hospital) will be assigned to this patient as his hospital. But I want to “FLAG’ this patient.
Data I have:
Patient_ID
Hospital
1
A
1
A
1
C
1
B
1
.
2
E
2
F
3
D
3
F
3
B
3
B
4
.
4
.
5
G
5
G
Data I want:
Patient_ID
Hospital
New_hospital
FLAG
1
A
A
1
A
A
1
C
A
1
B
A
1
.
A
2
E
E
1
2
F
E
1
3
D
B
3
F
B
3
B
B
3
B
B
4
.
.
4
.
.
5
G
G
5
G
G
Thank you very much for your support.
... View more