Hey guys
This is probably really simple but I am having a bit of trouble getting it to work so thought I would ask 🙂
I need to create a new data set that omits observations if they are present in a previous data set.
For example:
Source Data
NAME NUMBER
John 85656
Larry 56464
Tom 38164
Old Data Set
NAME NUMBER
Bob 25685
Steve 56468
Tom 38164
New Data Set
NAME NUMBER
John 68565
Larry 56464
Thanks for any and all help with this.
Josh
You can get the output by merge statement
proc sort data=source;
by name;
run;
proc sort data=old;
by name;
run;
data new;
merge source(in=a) old(in=b);
by name;
if a and not b;
run;
proc sql;
create table new as
select * from source
where number not in (select number from old);
quit;
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.