I want to merge two sas datasets that have the same ID but there is always something wrong.
I checked that the variable baseid in two datasets are all character, so I tried to adjust the id formats for both datasets by using the same code like this
data a;
set a;
baseidtemp = put(baseid,12);
drop baseid;
rename baseidtemp = baseid;
run;
After that I sorted both datasets by baseid.
But I don't know why when I used proc compare to compare their ID, all of the obs are unequal even if their values are all the same.
I merged them in this way
data A;
merge A (in = a) B;
by baseid;
if a;
run;
They just cannot be merged correctly.
I am very confused about it, so could someone help me with how to solve this issue?
Thank you in advance!
Proc CONTENTS
– Richard