Your example datasets fall into the last category.
If there are, indeed, supposed to be two different observations with ID = "111111110" in each data set, then, yes, the data are correct and -joinby- is appropriate. In that case, the results will have both observations from each data set paired with both of those observations in the other. In other words, there will be 2x2 = 4 observations with ID = "111111110" in the resulting dataset. If that is what is intended, go ahead and use -joinby-. It's legal, but it's uncommon. And given that all the other values of ID occur only once, I think it is more likely that we are looking at bad data. Only O.P. can tell for sure.
Comment