Hello,
I am trying to merge two datasets based on a character variable 'AdmissionID.' I am looking for a left join. I've tried the following code (see below), however only very few observations from the table DADmerge3 merge (despite seemingly apparent AdmissionIDs). I've read through multiple SAS help forums, tried to harmonize the AdmissionID variables etc, and no luck!
I've tried:
proc sort data=export.combine6;
by AdmissionID;
run;
proc sort data=export.DADmerge4;
by AdmissionID;
run;
data mergeDADCR;
merge export.combine6 (in=CR) export.DADmerge4 (in=DAD);
by admissionID;
if CR then export;
run;
Here is an example of how I would like the data to merge:
Combine 6:
AdmissionID RBC WBC
1 5 7
1 4 6
2 4 5
DADmerge4:
AdmissionID Transfusion Num
1 1 8
2 4 3
3 5 4
Merged set:
AdmissionID RBC WBC Transfusion Num
1 5 7 1 8
1 4 6 1 8
2 4 5 4 3
Any help would be very appreciated!!
Thanks,
Brett