Date: Tue, 25 Jul 2000 12:43:35 -0700
Reply-To: Ya Huang <ya.huang@AGOURON.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ya Huang <ya.huang@AGOURON.COM>
Subject: Re: how to create a cross-tabulated data set?
Content-Type: text/plain; charset=us-ascii
OK, I forgot the id options, here is a modified one, this
time it should be OK:
data xx;
input VAR1 $ VAR2 $;
cards;
a x
a y
b x
b x
c y
c y
c w
c y
d k
d m
d x
;
proc freq noprint;
table var1*var2/ out=yy;
run;
proc transpose data=yy (keep=var1 var2 count)
out=zz (drop=_name_ _label_);
by var1;
id var2;
run;
options nocenter missing='0';
title;
proc print data=zz;
run;
------------------------------
OBS VAR1 X Y W K M
1 a 1 1 0 0 0
2 b 2 0 0 0 0
3 c 0 3 1 0 0
4 d 1 0 0 1 1
Dmitry Mesyanzhinov wrote:
>
> Ya Huang wrote:
> >
> > Here is one (assuming that var2 can only have value 'x' or 'y'):
>
> Thanks for your response.
> However, there are several hundred different values in my real data; so
> manual renaming is not very efficient.
>