SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Removing information from a dataset that is contained elsewhere

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

Removing information from a dataset that is contained elsewhere

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? 


Accepted Solutions
Solution
‎06-13-2016 01:45 PM
Super User
Posts: 11,343

Re: Removing information from a dataset that is contained elsewhere

Posted in reply to mphqueens

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


All Replies
Super Contributor
Posts: 441

Re: Removing information from a dataset that is contained elsewhere

Posted in reply to mphqueens

How about this

Proc sql;
Create table c as
Select * from a where nog exists (select * from b);
Quit;
Solution
‎06-13-2016 01:45 PM
Super User
Posts: 11,343

Re: Removing information from a dataset that is contained elsewhere

Posted in reply to mphqueens

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

☑ This topic is solved.

Need further help from the community? Please ask a new question.

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