Hi All,
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.
proc sql;
create table match as
select *
from success as a full join ringtm as b
on a.mobile_num=b.mobile_num
full join Hung_Up as c
on b.mobile_num=c.mobile_num
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 ;
quit;
Regards,
Anil
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;
You mentioned "I need to extract the common records from all 7 datasets"
Try using intersect aka set operators
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.