Date: Wed, 26 Mar 2003 08:39:26 -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
Content-Type: text/plain; charset="iso-8859-1"
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