DATA Step, Macro, Functions and more

Excluding people from a second dataset

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 138
Accepted Solution

Excluding people from a second dataset

Hi,

I have a dataset where each row represents one person, with duplicates, like this:

Person

A

B

A

A

B

C

Then I have a second similar dataset, one row per person.

What I want to be able to do is remove people from the first dataset if they are present in the second dataset. Any help is much appreciated.

Thanks!


Accepted Solutions
Solution
‎03-11-2014 02:50 PM
Super Contributor
Posts: 578

Re: Excluding people from a second dataset

proc sql;

create table want as

select

     t1.*

from

     dataset1 as t1

     left outer join dataset2 as t2

          on t1.person=t2.person

where

     t2.person is null;

quit;

View solution in original post


All Replies
Solution
‎03-11-2014 02:50 PM
Super Contributor
Posts: 578

Re: Excluding people from a second dataset

proc sql;

create table want as

select

     t1.*

from

     dataset1 as t1

     left outer join dataset2 as t2

          on t1.person=t2.person

where

     t2.person is null;

quit;

☑ This topic is SOLVED.

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

Discussion stats
  • 1 reply
  • 147 views
  • 0 likes
  • 2 in conversation