I'm merging two datasets (let's call them DatasetA and DatasetB) by two string variables: "journal" and "field". Both DatasetA and DatasetB are "isid journal field".

When I open DatasetA and run:

merge 1:1 journal field using DatasetB

I get the error "variables journal field do not uniquely identify observations in the master data".

BUT I have run "isid journal field" right before the merge, verified that nothing is missing with "assert !missing(journal,field)" and even run "bys journal field: keep if _n==1". For completeness, I have also done this in the using dataset. All the checks pass and nothing gets dropped with the "keep" command, but I still get the error. I get this error in Stata 15 and Stata 16.

Any ideas as to what could be going on are welcome!