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.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.