Let;
data aa;
input Name $ Age Height;
datalines;
Adam 55 100
Jack 60 110
Stacy 42 105
Rabecca 32 100
Jacob 63 99
Jack 89 150
Don 100 140
;
data bb;
input Name $ Age;
datalines
Jack 50
Don 90
Tony 67
;
Here names Jack and Don are present in both the data sets. But have mismatching ages....which I do not care.
My question is
I want to create a new data set cc from aa such that it does not contain the the names which are in data set bb.
In above example jack( needs to deleted from both the rows) and don need to be deleted from data set aa to give data set cc.
Any suggestions?
Thanks.
Is SQL ok?
proc sql;
create table cc as
select * from aa where Name not in (select Name from bb);
quit;
Thanks PG Stats, Never thought I could get an answer this early...with in minutes. Thanks.
Thanks Arthur.
or, with datastep:
proc sort data=aa;
by name;
run;
proc sort data=bb;
by name;
run;
data want;
merge aa bb (in=inbb keep=name);
by name;
if not inbb;
run;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.