BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mphqueens
Fluorite | Level 6

I have two data sets, A and B.  A is larger and contains all the same information as B plus extra (B was created from A using proc sql - selecting distinct observations). I would like to remove everything that is contained in data set B from data set A to have two distinct sets with no duplicate variables. 

 

How would I go about this? 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

If all the variables are the same

Proc sql;
   create table want as
   select * from A
   except
   select * from B
   ;
quit;

I think @jklaverstijn may have meant NOT instead of NOG

View solution in original post

2 REPLIES 2
jklaverstijn
Rhodochrosite | Level 12

How about this

Proc sql;
Create table c as
Select * from a where nog exists (select * from b);
Quit;
ballardw
Super User

If all the variables are the same

Proc sql;
   create table want as
   select * from A
   except
   select * from B
   ;
quit;

I think @jklaverstijn may have meant NOT instead of NOG

sas-innovate-2024.png

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.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 840 views
  • 2 likes
  • 3 in conversation