Hi all
I have two datasets.A and B as follows
A B
Eid Eid
1 3
2 4
3 5
I need o/p as follows
Eid
1
2
4
5
I dont want value 3 in o/p dataset.Can anybody help me to solve this.
Thanks & Regards
Rawindarreddy
data a;
input v;
cards;
1
2
3
;
data b;
input v;
cards;
3
4
5
;
data want;
merge a(in=a) b(in=b);
by v;
if a and b then delete;
run;
Haikuo
Hi ,
Try this..
data a;
input no;
cards;
1
2
3
;
run;
data b;
input no;
cards;
3
4
5
;
run;
data c;
merge a(in=a) b(in=b);
by no;
if a ne b ;
run;
Thanks,
Shiva
Oops, just notice that OP asked in Proc section, so proc sql may be actually needed:
data a;
input v;
cards;
1
2
3
;
data b;
input v;
cards;
3
4
5
;
proc sql;
create table want as
select * from a
union corr
select * from b
except
(select * from a
intersect corr
select * from b);
quit;
Haikuo
Since the subject was interview question, I would think that multiple answers would be preferred. Thus, I would definitely include interleaving (see, e.g., http://www.sascommunity.org/wiki/Tips:Interleaving ).
Plus, it was never mentioned why 3 wasn't wanted, just that it wasn't wanted and not necessarily just because it was in both datasets. If it was just because its value was three, I would use an if EID ne 3 statement in the code.
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.