first, read the data into SAS datasets.
second, write a SQL SELECT statement to do the join.
third, address records in a with two or more matches in b.
Three simple steps. But if you have never used SQL it is not so simple. Something like
SELECT a., b., complev(on a and b)
FROM a, b
WHERE MIN(complev(on a and b)) > 0;
I've not tried this code, but that is where I would start.
Note that, as MIN is a summary function and used in the WHERE clause, this is a Cartesian product "under the hood" so it does not scale well. It's OK for 100x200, but would take forever for 100,000x200,000.
I wrote this without SQL, I read everything all the words as seperate variables instead of observations. It outputs dvar1-dvar100 which correspond to atxt vars 1-100 and has values of the the btxt vars that are closest to these atxt vars.
set atxt (rename=(var1-var100=avar1-avar100));
set btxt (rename=(var1-var200=bvar1-bvar200));
data textfiles (keep=dvar1-dvar100);
merge atxt btxt;
array avars $ avar1-avar100;
array bvars $ bvar1-bvar200;
array eddis cvar1-cvar200;
array mindis dvar1-dvar100;
do i = 1 to dim(avars);
do j = 1 to dim(bvars);