02-26-2018 11:26 AM
I have 7 datasets and I need to extract the common records from all 7 datasets and I wrote a Proc SQL query.
Please correct me where i did wrong in the below code.
create table match as
from success as a full join ringtm as b
full join Hung_Up as c
full join ub1 as d
on c.mobile_num = d.mobile_num
full join ntwk as e
on d.mobile_num = e.mobile_num
full join ivd as f
on e.mobile_num =f.mobile_num
full join other_error as g
on f.mobile_num =g.mobile_num
where a.mobile_num and b.mobile_num
and c.mobile_num and d.mobile_num and e.mobile_num
and f.mobile_num and g.mobile_num ;
02-26-2018 11:51 AM
If you have seven circles ad you only want to select those records where all seven circle overlap, you want an inner join.
proc sql; create table match as select * from success a inner join ringtm b on a.mobile_num=b.mobile_num inner join Hung_Up c on a.mobile_num=c.mobile_num inner join ub1 d on on a.mobile_num = d.mobile_num inner join ntwk e on a.mobile_num = e.mobile_num inner join ivd f on a.mobile_num = f.mobile_num inner join other_error g on a.mobile_num = g.mobile_num; quit;