DATA Step, Macro, Functions and more

Merging the dataset

Reply
Contributor
Posts: 69

Merging the dataset

I have a two datasets.I need to get the output as follows:

data one;
input x;
1
2
3
4
5
6;
run;
data two;
input x;
1
3
6
7
8
9
;
run;

the ouput is as follows:

4
5
6
7
8
9
Super User
Posts: 5,424

Re: Merging the dataset

Posted in reply to Siddhartha
Sorry, I can't see the logic. Please add some description of your problem.
/Linus
Data never sleeps
Contributor
Posts: 69

Re: Merging the dataset

The final output should be as follows:

4
5
6
7
8
9

Regards,
Siddhartha
Contributor
Posts: 69

Re: Merging the dataset

Posted in reply to Siddhartha
Yes, I need to get all non matching observations.

Thanks in advance.

Regards,
Siddhartha
Super User
Posts: 5,424

Re: Merging the dataset

Posted in reply to Siddhartha
I geuss that you want "2" as well?

data three;
merge one(in=a) two(in=b);
by x;
if a and not b or not a and b;
run;
Data never sleeps
Respected Advisor
Posts: 3,799

Re: Merging the dataset

[pre]if not(a and b);[/pre]
Regular Contributor
Posts: 165

Re: Merging the dataset

Posted in reply to Siddhartha
I think you need to elaborate more. It almost looks like you want all non-matching obs except that 6 is in both datasets.
Ask a Question
Discussion stats
  • 6 replies
  • 135 views
  • 0 likes
  • 4 in conversation