I've been puzzling over this for some months. I have a work-around that gets the job done, but there has to be a more efficient and slicker way to do this than what I do now (proc sql maybe?).
A genomics application. I have dataset A with a number of observations (10^2 - 10^4). Each observation has a chromosome (1-22) plus starting base and ending base. Call these A, A1, and A2). I have a second dataset, B, with a different set of features but is much larger (10^6-10^7), each with a chromosome and starting and ending base (B, B1, and B2).
Taking the first observation in A, find all rows in B with the same chromosome and with any overlap. There may be more than one. So, a row in B matches if A=B and (A1 le B1 le A2 or A1 le B2 le A2 or B1 le A1 le B2 or B1 le A2 le B2). Repeat for all observations in A.
Is there a fast and elegant way to do this? Many thanks in advance for any hints you might have - PFS