Date: Tue, 3 Feb 2009 04:43:32 -0800
Reply-To: chumba <vikas.dharamsattu@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: chumba <vikas.dharamsattu@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: Combining 3 datasets into a file row by row one after the
Content-Type: text/plain; charset=ISO-8859-1
On Feb 3, 4:33 am, dorjeta...@GOOGLEMAIL.COM (karma) wrote:
> Hi Peetie,
>
> Your solution assumes that either alldatasetshave the same number of
> observations, or that table 1 and 2 have at most, 1 record more than
> table3. If the end of buffer for any dataset is reached at any
> point, the datastep will stop executing. For example num =9 will not
> be present on the final dataset.
>
> dataone;
> input num @@;
> cards;
> 1 4
> ;
> data two;
> input num @@;
> cards;
> 2 5
> ;
> data three;
> input num @@;
> cards;36 9
> ;
> data merged;
> setone;output;
> set two;output;
> set three;output;
> run;
> proc print;run;
>
> 2009/2/2 Peetie Wheatstraw <peetie.wheatst...@gmail.com>:
>
>
>
> > Perhaps the simplest approach:
>
> > data all3;
> > set table1; output;
> > set table2; output;
> > set table3; output;
> > run;
>
> > Peetie
>
> > On Mon, 2 Feb 2009 03:00:16 -0800 (PST), chumba <vikas.dharamsa...@gmail.com> wrote:
>
> >>Hey All,
>
> >>I need to combine3datasetsintoafilerowbyrowsuch that first
> >>observation from the first dataset
> >>precedes the firstrowof the second dataset which inturn precedes the
> >>firstrowof the third dataset and so on.
>
> >>ie.
>
> >>table1 NEW
> >>DATASET
> >> obs num
> >>obs1 ------------------------------------> 1
> >>obs1 (table1)
> >>obs2
> >>obs3
> >>obs4
> >>obs5
>
> >>table2
>
> >>obs1 -------------------------------------> 2
> >>obs1 (table2)
> >>obs2
> >>obs3
> >>obs4
> >>obs5
>
> >>table3
>
> >>obs1 -----------------------------------------> 3
> >>obs1 (table3)
> >>obs2
> >>obs3
> >>obs4
> >>obs5 4
> >>obs2 (table1)
> >> 5
> >>obs2 (table2)
> >> 6
> >>obs2 (table3)
>
> >>.......and so on...........
>
> >>Can anyone please help me out on this.
>
> >>Thanks,
> >>Vikas- Hide quoted text -
>
> - Show quoted text -
Hi all,
Thank you for all your replies, much appreciated.
Special thanks to Nat as his suggestion works.
I also need to put a header and a trailer as the first and the last
row in my final text file which consists of these combined datsets,
such as header - AZ0983B765
|
|
tail - BZ127
Any suggestion will be highly appreciated.
Thanks
|