Date: Fri, 23 Jan 2004 16:27:53 -0330
Reply-To: Nan Li <nanl@NLCHI.NF.CA>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nan Li <nanl@NLCHI.NF.CA>
Subject: Re: Question about converting data from vertical to horizontal
Content-Type: text/plain; charset="ISO-8859-1"
Venita, Bruce, and Paul,
Thank you very much for your quick response. Yes, I left VAR statemant in my
proc transform. Thanks again!
-----Original Message-----
From: DePuy, Venita [mailto:depuy001@dcri.duke.edu]
Sent: Friday, January 23, 2004 4:04 PM
To: SAS-L@LISTSERV.UGA.EDU; 'Nan Li'
Subject: RE: Question about converting data from vertical to horizontal
Hi Nan et al -
I'm guessing you left the BY statement out of Proc Transpose.
Working program follows.
HTH,
Venita
data file1;
input care_epi dx_code $;
cards;
275332 1534
275332 1976
275333 5532
275333 1970
275333 V100
275334 V168
275334 4349
275335 2780
275335 3429
275335 E8781
;
proc print;run;
proc transpose out=out1;
var dx_code;
by care_epi;
proc print data=out1;
data out1;
set out1 (rename= (col1 = dx_cod1 col2=dx_cod2 col3=dx_cod3));
drop _NAME_;
proc print;run;
> ----------
> From: Nan Li[SMTP:nanl@NLCHI.NF.CA]
> Reply To: Nan Li
> Sent: Friday, January 23, 2004 2:30 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Question about converting data from vertical to horizontal
>
> Dear lister,
>
> Could you please let me know how I could convert the following data from
> vertical to horizontal. I tried to using proc transponse, but it seems not
> work in the way that I want. Any help would be highly appreciated!
>
> The input data like this:
>
> care_epi dx_code
> (numeric) (character)
> 275332 1534
> 275332 1976
> 275333 5532
> 275333 1970
> 275333 V100
> 275334 V168
> 275334 4349
> 275335 2780
> 275335 3429
> 275335 E8781
>
> I want the output like the following:
>
> care_epi dx_cod1 dx_cod2 dx_cod3
>
> 275332 1534 1976
> 275333 5532 1970 V100
> 275334 V168 4349
> 275335 2780 3429 E8781
>
> Thanks!
>
> Nan
>
> By the way, could you please reply to my email, since I'm only on the
> digest
> list. Thanks again.
>
|