Date: Fri, 3 Dec 2004 16:51:03 -0000
Reply-To: nageswara punnani <npunnani@rediffmail.com>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: nageswara punnani <npunnani@REDIFFMAIL.COM>
Subject: Re: by group processing and array
Content-Type: text/plain; charset=iso-8859-1
Thanks a lot amit . At the very beginning i had this proc transpose at the back of my mind , but thought may be this is slightly out of reach for that procedure. I have learnt something new about proc transpose today.
Thank you again.
Rao.
On Fri, 03 Dec 2004 Dhameja,Amit wrote :
>Rao,
>
>The following proc transpose should work fine for any number of codenums...
>
>data test;
>
> input id date1 mmddyy10. +1 date2 mmddyy10. +4 code $7. +1 codenum;
>
>cards;
>
>671 03/26/2004 04/08/2004 996.1 1
>
>671 05/03/2004 05/17/2004 427.5 1
>
>700 06/25/2003 06/29/2003 531.40 1
>
>700 06/25/2003 06/29/2003 578.9 2
>
>700 03/15/2004 03/19/2004 786.5 1
>
>700 03/15/2004 03/19/2004 V12.51 2
>
>700 03/15/2004 03/19/2004 V58.61 3
>
>
>
>run;
>
>
>
>proc transpose data=test prefix=code;
>
> by id date1 date2;
>
> var code;
>
> id codenum;
>
>run;
>
>
>HTH,
>Amit
>
>-----Original Message-----
> From: nageswara punnani [mailto:npunnani@REDIFFMAIL.COM]
>Sent: Friday, December 03, 2004 11:28 AM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: [SAS-L] by group processing and array
>
>
>
>hello all ,
>
> i have a data set that looks like this .
>
> id date1 date2 code codenumber
>671 03/26/2004 04/08/2004 996.1 1
>671 05/03/2004 05/17/2004 427.5 1
>700 06/25/2003 06/29/2003 531.40 1
>700 06/25/2003 06/29/2003 578.9 2
>700 03/15/2004 03/19/2004 786.5 1
>700 03/15/2004 03/19/2004 V12.51 2
>700 03/15/2004 03/19/2004 V58.61 3
>
>i want to have a dataset like this
>
>id date1 date2 code1 code2 code3
>671 03/26/2004 04/08/2004 996.1
>671 05/03/2004 05/17/2004 427.5
>700 06/25/2003 06/29/2003 531.40 578.9
>700 03/15/2004 03/19/2004 786.5 V12.51 V58.61
>
>and the codenumbers can be more than three within a by group . depending on
>the no of codenumbers within the by group of id and date1 it should assign
>the no of code(n) variable. any help would be greatly appreciated.
>
>Thanks in advance.
>Rao.
|