Solved
Contributor
Posts: 60

# how to get non matching observations from one data set only

Hi everyone,

Building off of this post:

https://communities.sas.com/t5/SAS-Procedures/how-to-get-non-matching-observations/m-p/97985#M27616

Using this code:

``````data Match Nomatch;
merge a (in=ina) b (in=inb);
by no;
if ina and inb then output match;
else output Nomatch;
run;``````

I would like to output a data set that includes observations that did not match dataset "a" only. Any suggestions on where to start?

Accepted Solutions
Solution
‎09-01-2017 10:10 AM
Super Contributor
Posts: 331

## Re: how to get non matching observations from one data set only

```data Match Noamatch Nobmatch;
merge a (in=ina) b (in=inb);
by no;
if ina and inb then output match;
else if not ina then output Noamatch;
else output Nobmatch;
run;```

All Replies
Super Contributor
Posts: 331

if not ina ?
Contributor
Posts: 60

## Re: how to get non matching observations from one data set only

How would you code that?
Solution
‎09-01-2017 10:10 AM
Super Contributor
Posts: 331

## Re: how to get non matching observations from one data set only

```data Match Noamatch Nobmatch;
merge a (in=ina) b (in=inb);
by no;
if ina and inb then output match;
else if not ina then output Noamatch;
else output Nobmatch;
run;```
Contributor
Posts: 60

## Re: how to get non matching observations from one data set only

Thank you!
☑ This topic is solved.

Discussion stats
• 4 replies
• 146 views
• 0 likes
• 2 in conversation