DATA Step, Macro, Functions and more

How to delete those observations of table A that are all contained in table B

Reply
Occasional Contributor
Posts: 17

How to delete those observations of table A that are all contained in table B

Hi,

How can I delete those observations in table A that are all contained in table B,that is, I don't want all those observations of table B to present in table A.

Thanks!

Respected Advisor
Posts: 4,644

Re: How to delete those observations of table A that are all contained in table B

Probably the simplest way is:

proc sql;

create table C as

select * from A except all corr select * from B;

drop table A;

quit;

PG

PG
Frequent Contributor
Posts: 106

Re: How to delete those observations of table A that are all contained in table B

Data step alternative:

proc sort data=table1;by _all_ ;
proc sort data=table2;by _all_ ; run;

data table3;

merge table1(in=a) table2(in=b);

by _all_ ;

if a and not b;

run;

Ask a Question
Discussion stats
  • 2 replies
  • 258 views
  • 3 likes
  • 3 in conversation