| Date: | Wed, 28 Nov 2001 07:39:38 -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 merge question |
|
| Content-Type: | text/plain; charset=iso-8859-1 |
Hi Dave,
Here's one way:
data mytable;
input ID year score;
cards;
01 2 55
01 4 59
02 1 33
02 2 36
02 4 48
03 1 50
03 3 56
;
run;
proc sort data=mytable;
by year id;
run;
proc transpose data=mytable
out=result(drop=_name_)
prefix=Score;
by year;
id id;
var score;
run;
Hope this is helpful,
Mark Terjeson
Washington State Department of Social and Health Services
Division of Research and Data Analysis (RDA)
mailto:terjemw@dshs.wa.gov
-----Original Message-----
From: David Shen [mailto:consultant121@HOTMAIL.COM]
Sent: Wednesday, November 28, 2001 7:15 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Data merge question
Hello,
I have a dataset like this:
ID year score
01 2 55
01 4 59
02 1 33
02 2 36
02 4 48
03 1 50
03 3 56
I'd like to transfer this data into the following (I already did for a small
dataset):
year score1 score2 score3
1 33 50
2 55 36
3 56
4 59 48
Q: Is there any better way to do this with least amount of code for a very
large dataset? Thanks.
Dave
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
|