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

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!

1 ACCEPTED SOLUTION

Accepted Solutions
DBailey
Lapis Lazuli | Level 10

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

1 REPLY 1
DBailey
Lapis Lazuli | Level 10

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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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