Date: Wed, 26 Mar 2003 09:40:41 -0800
Reply-To: "Huang, Ya" <yhuang@AMYLIN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Huang, Ya" <yhuang@AMYLIN.COM>
Subject: Re: Transposing the data (proc report version)
Content-Type: text/plain; charset="iso-8859-1"
Sam wants a proc report version (or data _null_) after seeing
my tabulate version. He dose not seem to like proc tabulate :-)
Anyway, I believe data _null_ can do the job too, but may need
a bit more preprocessing (note the raw data is not sorted),
on the contrary, report can do it in one step, just like tabulate.
Here is the code (still need the proc format part):
proc report headline nowd;
column patient dname,ynn;
define patient / group;
define dname /' ' across;
define ynn /' ' analysis sum format=yn.;
run;
-------------
A B C D E
patient
-----------------------
01 y n y y n
04 n y n y n
Regards,
Ya
-----Original Message-----
From: archana g s [mailto:archana_gs@lycos.com]
Sent: Wednesday, March 26, 2003 9:24 AM
To: Huang, Ya
Subject: RE: Transposing the data
Thanks .can u please let me know using data null or proc report
--
On Wed, 26 Mar 2003 08:39:26
Huang, Ya wrote:
>Since you want a list, you don't have to go through
>transpose to get the data set restructured first. You
>can go straight to reporting. Here I use proc tabulate.
>Note, since proc tabulate dose not allow the analysis
>var to be character, I have to use format/informat to
>convert yn var to numeric and back to character when
>finally in the table:
>
>proc format;
>invalue yn
>y=1 n=0;
>value yn
>1='y' 0='n';
>
>data xx;
>input Dname $ patient $ yn $ dcode;
>ynn=input(yn,yn.);
>cards;
> A 01 y 1
> B 01 n 2
> C 01 y 3
> D 01 y 4
> E 01 n 5
> B 04 y 2
> C 04 n 3
> A 04 n 1
> D 04 y 4
> E 04 n 5
>;
>
>options nocenter formchar='|----|+|---';
>
>proc tabulate;
>class patient dname;
>var ynn;
>table patient='', dname=''*ynn=''*sum=''*f=yn. /rts=10;
>run;
>--------------
>--------------------
>| |A|B|C|D|E|
>|--------+-+-+-+-+-|
>|01 |y|n|y|y|n|
>|--------+-+-+-+-+-|
>|04 |n|y|n|y|n|
>--------------------
>
>HTH
>
>Ya Huang
>
>-----Original Message-----
>From: Sam [mailto:archana_gs@MAILCITY.COM]
>Sent: Wednesday, March 26, 2003 8:15 AM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Transposing the data
>
>
>The data is like this,
>
>Dname patient y/n dcode
> A 01 y 1
> B 01 n 2
> C 01 y 3
> D 01 y 4
> E 01 n 5
> B 04 y 2
> C 04 n 3
> A 04 n 1
> D 04 y 4
> E 04 n 5
>
>
>I have to generate listing which looks like
>
>Patient A B C D
> E
>
>01 Y N Y y
> N
>04 n y n y
> n
>
>
>Please explain how to get the output.Can I use proc transpose or is
>there any other way.
>
>Thank you
>
_____________________________________________________________
Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year.
http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus
|