Date: Wed, 15 Feb 2006 09:18:31 -0500
Reply-To: mah-j@statworks.com
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "mah-j@statworks.com" <msoobader@VERIZON.NET>
Subject: Re: Combining multiple observations into one observation.
In-Reply-To: <200602151100.k1F8cINK016525@mailgw.cc.uga.edu>
Content-type: text/plain; charset=iso-8859-1
I got a simpler solution from SAS-L earlier.
Try:
proc summary data=datain nway;
class id;
var SAT_MATH: SAT_VERBAL: ACT_COMP:;
output out=dataout max=;
run;
HTH,
Mah-J
M. Soobader, PhD
STATWORKS
www.statworks.com
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of Jim
Groeneveld
Sent: Wednesday, February 15, 2006 6:01 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Combining multiple observations into one observation.
Hi Jim,
Use my macro MPR2SR.sas (Multiple Partial Records to Single Records) from
http://home.hccnet.nl/jim.groeneveld/software/SASmacro/MPR2SR.zip
It is a very experimental macro, lastly used with SAS vs. 6.12. It still
has to be adapted for longer SAS names with SAS vs. 8 and 9. You also need
the auxiliary macro ChkVar.sas (in ChkVar.zip) from the same webdirectory.
It fully automatically compresses those data structures without loosing
information; if an ID has more than one (different) value, it keeps them in
different records.
Regars - Jim.
--
Jim Groeneveld, Netherlands
Statistician, SAS consultant
home.hccnet.nl/jim.groeneveld
[common disclaimer]
On Tue, 14 Feb 2006 18:46:00 -0500, James Castiola <James.Castiola@UMB.EDU>
wrote:
>SAS-L
>
>I have a dataset that is similar to the following:
>
>ID SAT_MATH SAT_VERBAL ACT_COMP
>8188 560 . .
>8188 . 540 .
>8188 . . 12
>...
>
>I want to "compress" this dataset into one observation per ID, so that
>it looks like this:
>
>ID SAT_MATH SAT_VERBAL ACT_COMP
>8188 560 540 12
>...
>
>While the solution is probably obvious, I am embarrassed to say that I
>have been working at this for some time and have not figured it out yet.
>I have searched the SAS-L archives, but I am not sure which search terms
>to use so I haven't found quite what I am looking for. I'd appreciate
>any help you can give to me.
>
>Using SAS v9 on Windows XP.
>
>Thanks,
>
>Jim.
>
>Jim Castiola
>Office of Institutional Research and Policy Studies
>University of Massachusetts, Boston