Date: Wed, 24 May 2000 10:01:24 -0400
Reply-To: Mark.K.Moran@CCMAIL.CENSUS.GOV
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mark.K.Moran@CCMAIL.CENSUS.GOV
Subject: Re: Alternating Rows of Data
Content-type: text/plain; charset=us-ascii
Thank you Jim, and everyone else who helped!
Mark
Jim Groeneveld <J.Groeneveld@ITGroups.com> on 05/24/2000 09:17:06 AM
To: Mark K Moran/CSD/HQ/BOC@BOC
cc: SAS-L@LISTSERV.UGA.EDU
Subject: RE: Alternating Rows of Data
Mark,
Tested shortest solution I could think of:
DATA A (DROP=A5 -- A8) B (DROP=A1 -- A4 RENAME=(A5 = A1 A6 = A2 A7 = A3 A8 =
A4));
INPUT A1 - A8;
cards;
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
;
run;
PROC PRINT DATA=A; TITLE "Data A"; RUN;
PROC PRINT DATA=B; TITLE "Data B"; RUN;
Regards - Jim.
--
Y. Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070
senior statistician, P.O. Box 1 fax. +31 412 407 080
head IT department 5350 AA BERGHEM IMRO TRAMARKO: a CRO
J.Groeneveld@ITGroups.com the Netherlands in clinical research
It is my job to keep my computer at work, but its job is to reveal my work.
> -----Original Message-----
> From: Mark Moran [SMTP:Mark.K.Moran@CCMAIL.CENSUS.GOV]
> Sent: Tuesday, May 23, 2000 7:13 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Alternating Rows of Data
>
> I have data in the form of a cards statement. Lines of data alternate
> between
> what should go into dataset A and dataset B, as in
>
> cards;
> 1 2 3 4
> 5 6 7 8
> 9 10 11 12
> 13 14 15 16
> ;
> run;
>
> So that the dataset A should read:
>
> A1 A2 A3 A4
> 1 2 3 4
> 9 10 11 12
>
> ...and the dataset B should read:
>
> B1 B2 B3 B4
> 5 6 7 8
> 13 14 15 16
>
> Is there a way that I can set these two datasets in a single data step, or
> is
> there a better way to do this?
>
> Mark