It's easy to match the ID-TYPE in DataFile1 to ID-TYPE in DataFile2. But, I can see that you have a challenge on your hands trying to then figure out which IDs in DataFile1 are related to the same address so that you can output the ID associated with TYPE = A. There is no obvious key between TYPE = A and TYPE = B. It looks like you will have to use some kind of fuzzy merge matching to figure out which addresses in DataFile1 are related . . . You could try something like this (adapted from http://www.nesug.org/proceedings/nesug07/ap/ap23.pdf). Note: I'm not sure how well COMPGED deals with digits or punctuation. Also, you might want to strip out most punctuation and control characters before doing the comparison. %let maxscore=999; proc sql; create table matches as select a.id as a_id , a.address as addressA, b.id as b_id , b.address as addressB, compged(a.address,b.address,&maxscore,'iL' ) as gedscore from DataFile1 a, DataFile1 b where a.id < b.id and calculated gedscore < &maxscore order by calculated gedscore; quit;
... View more