Date: Mon, 13 Nov 2000 14:01:12 -0800
Reply-To: "Terjeson, Mark" <TERJEMW@DSHS.WA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Terjeson, Mark" <TERJEMW@DSHS.WA.GOV>
Subject: Re: Data Manipulation Question
Content-Type: text/plain; charset="iso-8859-1"
PROC TRANSPOSE works pretty good,
data test1;
input id1 id2 fact $;
cards;
1 11 A
2 12 C
2 13 A
2 14 C
3 15 B
3 16 C
4 17 D
;
run;
proc sort data=test1 out=test2;
by id1;
run;
proc transpose data=test2 out=test3(drop=_name_) prefix=fact;
by id1;
var fact;
run;
Hope this is helpful,
Mark Terjeson
Washington State Department of Social and Health Services
Division of Research and Data Analysis (RDA)
(253) 840-2800
(253) 840-3566 fax
(360) 902-0741
(360) 902-0705 fax
mailto:terjemw@dshs.wa.gov
-----Original Message-----
From: Jie Qin [mailto:c674010@YAHOO.COM]
Sent: Monday, November 13, 2000 12:21 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Data Manipulation Question
I know there is a sample code somewhere, but I
couldn't find it. Here is my dataset(id2 is unique in
the dataset):
id1 id2 fact
1 11 A
2 12 C
2 13 A
2 14 C
3 15 B
3 16 C
4 17 D
........
I want the dataset change to like this:
id1 fact1 fact2 fact3....
1 A
2 C A C
3 B C
4 D
.............
Does somebody know how to do that?
__________________________________________________
Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!
http://calendar.yahoo.com/