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 (June 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 19 Jun 2008 10:30:15 -0400
Reply-To:     Howard Alper <halper@HEALTH.NYC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Howard Alper <halper@HEALTH.NYC.GOV>
Subject:      Calculating means - with complication

Hi,

I have medical cost data on children for some or all months of 2007. A simplified sample of the data is given below (month=1=January, etc.) I want to calculate the mean montly expense per child. Normally, that would be easy with PROC MEANS, but there is a complication: I want the mean only over the six months with highest medical costs. If the child has data for more than six months, I want to calculate as above, but if the child has less than six months of data I'd like to take the average of all the monthly data for the child. How might I do this?

Thanks in advance,

Howard Alper

data homedir.test; input childid month cost; datalines; 1 1 90 1 3 100 1 5 66 1 8 99 1 9 44 1 10 23 1 12 555 2 2 94 2 7 82 2 12 54 ; run;


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