DATA Step, Macro, Functions and more

Combine two datasets that have no common variables

Accepted Solution Solved
Reply
Contributor
Posts: 63
Accepted Solution

Combine two datasets that have no common variables

Hi, I have a problem that need to combine (or merge) two datesets that have no common variables.

Here is an example:

data have1;

input x;

datalines;

1

2

3

4

run;

data have2;

input y;

datalines;

5

6

7

8

run;

data want;

input x y;

datalines;

1 5

2 6

3 7

4 8

run;

I am pretty sure that the variables in two datasets have exactly the same number of observations. 

Any suggestion is appreciated! Thank you.


Accepted Solutions
Solution
‎03-30-2018 01:54 PM
Super User
Posts: 8,218

Re: Combine two datasets that have no common variables

data want;
  set have1;
  set have2;
run;

Art, CEO, AnalystFinder.com

 

View solution in original post


All Replies
Solution
‎03-30-2018 01:54 PM
Super User
Posts: 8,218

Re: Combine two datasets that have no common variables

data want;
  set have1;
  set have2;
run;

Art, CEO, AnalystFinder.com

 

Contributor
Posts: 63

Re: Combine two datasets that have no common variables

Thank you.

☑ This topic is solved.

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

Discussion stats
  • 2 replies
  • 133 views
  • 0 likes
  • 2 in conversation