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 (July 2001, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 26 Jul 2001 13:05:04 -0400
Reply-To:     Jonathan Siegel <Jonathan.Siegel@PFIZER.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jonathan Siegel <Jonathan.Siegel@PFIZER.COM>
Subject:      Re: Data restructuring
Comments: To: Paolo ORIFICI <Orifici@LACAJA.COM.AR>

Hi Paolo,

Proc Summary is usually the simplest way to summarize data:

proc summary data=yourdata nway; class claim type; var paid; output out=newdata(rename=(type=type1)) sum(paid)=paid_sum; run;

If you have a lot of data and know your data is sorted, you can get faster results if you use:

proc summary data=yourdata; by claim type; var paid; output out=newdata(rename=(type=type1)) sum(paid)=paid_sum; run;

If you don't really need to rename TYPE, you can leave out the "(rename= (type=type1)) part.

Hope this helps,

Jonathan Siegel Pfizer Clinical Research and Development Ann Arbor Laboratories Jonathan.Siegel@pfizer.com 734.622.3982

On Thu, 26 Jul 2001 09:43:56 -0300, Paolo ORIFICI <Orifici@LACAJA.COM.AR> wrote:

>HI list members, > >I'm new to SAS. I want to restructure my SAS dataset in order to obtain a single observation from multiple records. > >The original data set has the following structure: > >Claim Type Paid >1 body 100 >1 body 70 >1 body 30 >2 material 5 >2 material 7 >3 body 70 >3 material 3 >3 material 8 >3 body 30 >4 material 12 >4 body 20 >5 body 120 > > >The new dataset should have this new structure: > >Claim Type_1 Paid_sum > >1 Body 200 >2 Material 12 >3 Mixed 111 >4 Mixed 32 >5 Body 120 > > > >Thank you in advance. > >Paolo Orifici


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