LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2000, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 25 Feb 2000 17:23:05 -0500
Reply-To:     Jeremy Miller <millerj@CALIB.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jeremy Miller <millerj@CALIB.COM>
Subject:      Re: Collapsing data in SAS
Comments: To: N Yiannakoulias <nwy@GPU.SRV.UALBERTA.CA>
Content-Type: text/plain

N,

This code will work if you're just trying to reproduce the output as you've outlined below.

data a; input ID date1 date2 date3; cards; 1 1 0 0 1 0 1 1 1 0 0 1 2 1 0 0 2 0 1 0 3 1 0 0 4 0 1 0 4 0 0 1 ; run;

proc sql; select id, max(date1) as date1, max(date2) as date2, max(date3) as date3 from a group by id; quit;

HTH

Jeremy T. Miller Caliber Associates 10530 Rosehaven St. STE 400 Fairfax, VA 22030 (703) 219-4332 www.calib.com

> -----Original Message----- > From: N Yiannakoulias [SMTP:nwy@GPU.SRV.UALBERTA.CA] > Sent: Friday, February 25, 2000 3:06 PM > Subject: Collapsing data in SAS > > Hi, > I need help on a SAS problem: > > Here's my data > > ID date1 date2 date3 > 1 1 0 0 > 1 0 1 1 > 1 0 0 1 > 2 1 0 0 > 2 0 1 0 > 3 1 0 0 > 4 0 1 0 > 4 0 0 1 > ... > > Each ID can exist in the data set from one to three times depending on > whether > or not it was present at a particular date. What I want is a file that is > collapsed like > this: > > ID date1 date2 date3 > 1 1 1 1 > 2 1 1 0 > 3 1 0 0 > 4 0 1 1 > ... > I can do this in C, but can't seem to get it right in SAS. I'm sure you > gurus have done > this kind of thing before, so any help would be appreciated. > > N


Back to: Top of message | Previous page | Main SAS-L page