Date: Tue, 10 Jul 2001 09:43:26 -0400 "Braten, Michael (Exchange)" "SAS(r) Discussion" "Braten, Michael (Exchange)" Re: Newbie and needs your help... very simple To: Gerhard Hellriegel text/plain

Assuming that there is a 1-to -1 correspondence then another way might be to create a merge key.

data table1; input a b c d e; mergekey +1;

cards; 1 2 3 4 5 2 3 4 5 6 3 4 5 6 7 ; run;

data table2; input f g h i j; mergekey +1;

cards; 2 3 4 5 6 2 3 4 5 6 4 5 6 7 8 ; run; proc sort data=table1 ; by mergekey ; run; proc sort data=table2 ; by mergekey ; run;

data table3; MERGE table1(in=A) table2(in=A); by mergekey; if A and B ;

> -----Original Message----- > From: Gerhard Hellriegel [SMTP:ghellrieg@T-ONLINE.DE] > Sent: Tuesday, July 10, 2001 7:42 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: Newbie and needs your help... very simple > > On Mon, 9 Jul 2001 15:20:00 -0700, Terjeson, Mark <TerjeMW@DSHS.WA.GOV> > wrote: > > >Hi Allie, > > > >Will something like this do? > > > > > >data table1; > > input a b c d e; > >cards; > >1 2 3 4 5 > >2 3 4 5 6 > >3 4 5 6 7 > >; > >run; > > > >data table2; > > input f g h i j; > >cards; > >2 3 4 5 6 > >2 3 4 5 6 > >4 5 6 7 8 > >; > >run; > > > >data table3; > > set table1; > > set table2; > >run; > > > > > >You don't mention some of your criterium, > >i.e. same number of rows in both sets? > >is it okay that row1 from each file gets > >glued together, and row2 in each, etc. > > > >If you have the same number of rows, this > >will work fine. You will have to make sure > >no variable names are duplicated. NOTE: > >this will truncate any extra rows left over > >on either side. It will stop when ever either > >table is done. > > > >Hope this is helpful, > >Mark Terjeson > >Washington State Department of Social and Health Services > >Division of Research and Data Analysis (RDA) > >mailto:terjemw@dshs.wa.gov > > > > > > > >-----Original Message----- > >From: Allie [mailto:nospam@NEWSRANGER.COM] > >Sent: Monday, July 09, 2001 1:35 PM > >To: SAS-L@LISTSERV.UGA.EDU > >Subject: Newbie and needs your help... very simple > > > > > >Hi Everybody... > > > >If I have 2 sets of card and want to put it together... how do I do that? > > > >cards; > >1 2 3 4 5 > >2 3 4 5 6 > >3 4 5 6 7 > > > >cards; > >2 3 4 5 6 > >2 3 4 5 6 > >4 5 6 7 8 > > > >Wants the output to be like this > >1 2 3 4 5 2 3 4 5 6 > >2 3 4 5 6 2 3 4 5 6 > >3 4 5 6 7 4 5 6 7 8 > > > >Please Advise > > > >Allie > > > > Another way is MERGE: > > data table3; > merge table1 > table2; > run; > > But be careful, how Mark said to use different variable names and the > number of obs must be the same.

*********************************************************************** Bear Stearns is not responsible for any recommendation, solicitation, offer or agreement or any information about any transaction, customer account or account activity contained in this communication. ***********************************************************************

Back to: Top of message | Previous page | Main SAS-L page