Date: Tue, 1 Jul 2003 08:28:39 -0400
Reply-To: Ernest Bowling <ernest.bowling@JWS.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ernest Bowling <ernest.bowling@JWS.COM>
Subject: Re: transpose data help
Doug,
Try this.
data new;
input id type $ qtr;
cards;
100 a 2
100 a 3
100 b 4
200 a 1
200 a 2
200 a 3
200 c 4
300 a 2
400 d 1
400 c 3
;
proc transpose data=new out=newer prefix=qtr;
by id;
id qtr;
var type;
run;
proc print data=newer;
var id qtr1-qtr4;
run;
Ernest
On Tue, 1 Jul 2003 04:59:36 -0700, Doug <queanbeyan@HOTMAIL.COM> wrote:
>Hi
>
>I have data like this
>id type qtr
>100 a 2
>100 a 3
>100 b 4
>200 a 1
>200 a 2
>200 a 3
>200 c 4
>300 a 2
>400 d 1
>400 c 3
>
>but I would like to have the data as
>id qtr1 qtr2 qtr3 qtr4
>100 a a
>200 a a a c
>300 a
>400 d c
>
>I have tried proc transpose as
>proc transpose data=new out=newer prefix=qtr;
>by id;
>id qtr;
>run;
>but this doesn't seem to work for me.
>
>Thanks
>
>Doug
|