I'm not sure if it'd make a huge difference but I've always had performance problems with OR's in JOIN conditions and try to avoid them, although I generally do all this in SQL Passthrough, I'm not sure if it makes a difference in straight PROC SQL. You could try something like this: proc sql;
create table want as
select a.*
,b.key_b
,b.name_b
,(a.name_a=b.name_b) as match_ind
from have1 a
inner join have2 b
on a.zip_a = b.zip_b
UNION ALL
select a.*
,b.key_b
,b.name_b
,(a.name_a=b.name_b) as match_ind
from have1 a
inner join have2 b
on a.zip2_a = b.zip_b
order by key_a, key_b
;quit; I'd also be interested to see alternate approaches to this though, I generally go for a SQL centric solution since that's what I'm most used to, but I love seeing other ways to do things.
... View more