- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I have 3 data : tab1, tab2 and tab3 like this :
tab1 :
NAME1 NUMBER1
John 145
Max 200
tab2 :
NAME2 NUMBER2
Johny 1415
Maximus 4200
Vince 765
and tab3 :
NAME3 NUMBER3
Johnatan 145
Bruce 200
How to do a join like this ? :
NAME 1 NUMBER1 NAME2 NUMBER2 NAME3 NUMBER3
John 145 Johny 1415 Johnatan 145
Max 200 Maximus 4200 Bruce 200
. . Vince 765 . .
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
data want;
merge tab1 tab2 tab3;
run;
Regards,
Naveen Srinivasan
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It can be done like below.
But why do you want your data like this? Does not seem logical?
data tab1;
input NAME1 $ NUMBER1;
datalines;
John 145
Max 200
;
data tab2;
input NAME2 $ NUMBER2;
datalines;
Johny 1415
Maximus 4200
Vince 765
;
data tab3;
input NAME3 $ NUMBER3;
datalines;
Johnatan 145
Bruce 200
;
data want;
merge tab1-tab3;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It's because I have more than 500 obersations in each data (tab1, tab2, tab3)
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yeah, but why the wide structure that only makes your work more tedious in the future?
I'd much prefer
data want;
set
tab1 (rename=(name1=name number1=number))
tab2 (rename=(name2=name number2=number))
tab3 (rename=(name3=name number3=number))
;
run;
To get a unified table.