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 (October 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 27 Oct 2009 06:49:01 -0400
Reply-To:     Daniel Fernandez <fdezdan@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Daniel Fernandez <fdezdan@GMAIL.COM>
Subject:      Re: Hospital attendance
Comments: To: Donald Harrison <donald.will.harrison@GMAIL.COM>

here my code:

data have; input PAT_ID $ month1 month2 month3; cards; 1 0 1 2 2 1 1 2 3 2 0 1 4 0 0 3 5 3 0 0 6 0 0 2 7 0 2 0 8 0 2 2 ;; run;

* I understand what you need is the sum of months result at the first month with data different than zero value; data need; set have ; array monz(3) month1 - month3; do y=1 to 3; if monz(y) NE 0 then monz(y)=sum(of month:); else monz(y)=.; end; if (month3 > month2 and (month2 NE . OR month1 NE .)) then month3=.; if (month2 > month1 and (month1 NE .)) then month2=.; drop y; run;

I hope it is helpful. Daniel Fernandez. Terrassa Hospital- Barcelona.


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