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 (May 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 19 May 2004 13:44:25 -0400
Reply-To:   Ying Hu <yhu@MAIL.NIH.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Ying Hu <yhu@MAIL.NIH.GOV>
Subject:   sum by id
Content-Type:   text/plain; charset=us-ascii; format=flowed

Hi, I have a data set as the following:

ID age income id1 25 12 id1 35 25 id1 45 25 id2 18 9 id2 30 7 id2 32 7 id3 20 2 id3 30 9 id3 40 0 id3 50 12 id3 53 12 ...

I want to sum the income by id: id1_income = (35-25+1)*12 + (45-35+1)*25 id2_income = (30-18+1)*9 + (32-30+1)*7 id2_income = (30-20+1)*2 + (40-30+1)*9 + (50-40+1)*0 + (53-50+1)*12

Thanks

Ying


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