Date: Mon, 5 Feb 1996 15:20:12 -0800
Reply-To: Karsten Self <karsten@NEWAGE1.STANFORD.EDU>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Karsten Self <karsten@NEWAGE1.STANFORD.EDU>
Subject: Re: How to merge a data set?
In-Reply-To: <DMBALA.H4v@cdf.toronto.edu>
Try:
data a;
input x1 x2 x3 x4;
cards;
1 13 45 6 7
2 33 13 1 33
3 45 1 5 6
4 55 20 34 11
;
run;
data b;
input y1 y2 y3 y4 y5;
format y1 - y5 4.2;
cards;
0.00 0.50 1.00 2.00 3.00
;
run;
proc sql;
create table merged
as select a.*, b.*
from a, b
quit;
proc print data= merged;
run;
The SAS System 1
14:46 Monday, February 5, 1996
OBS X1 X2 X3 X4 Y1 Y2 Y3 Y4 Y5
1 1 13 45 6 0.00 0.50 1.00 2.00 3.00
2 2 33 13 1 0.00 0.50 1.00 2.00 3.00
3 3 45 1 5 0.00 0.50 1.00 2.00 3.00
4 4 55 20 34 0.00 0.50 1.00 2.00 3.00
On Mon, 5 Feb 1996, Wilfred wrote:
> Hi does anyone know how to merge a dataset which has no common key.
> ie
>
> I have a data set like this
> 1 13 45 6 7
> 2 33 13 1 33
> 3 45 1 5 6
> 4 55 20 34 11
> 5 .....
> ....
> ...
>
> and I have another data set like this
> 0.00 0.50 1.00 2.00 3.00
>
> and I want a data set like this
> 1 13 45 6 7 0.00 0.50 1.00 2.00 3.00
> 2 33 13 1 33 0.00 0.50 1.00 2.00 3.00
> 3 45 1 5 6 0.00 0.50 1.00 2.00 3.00
> 4 55 20 34 11 0.00 0.50 1.00 2.00 3.00
> .....
> ...
>
>
> I try
> data a;
> input s1-s5;
> cards;
> ....
> ...
>
> data b;
> input t1-t5;
> ...
>
>
>
> data all; merge a b;
>
> but doesn't work.
>
> Thanks
>
---------------------------------------------
Karsten M. Self -- Sr. SAS Programmer/Analyst
Sierra Information Services, Inc.
Contracting for NBER at Stanford University
Karsten@newage1.Stanford.EDU
KMSelf@ix.netcom.com
What part of gestalt don't you understand?