```Date: Sun, 24 Jan 2010 09:38:21 +0100 Reply-To: Daniel Fernández Sender: "SAS(r) Discussion" From: Daniel Fernández Subject: Re: Calculations using dates Comments: To: "Schwarz, Barry A" In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Yes Barry, I guess Sdlentertd could be more clear to explain the example. I almost had to count the pills with my fingers by each day, as I only have 10 fingers on the hands, I damn it why pharmaceuticals produce so many pills a pack, then later I remembered I have more fingers on feet and I kept on counting.., this way 3 times until to arrive to 60... I finally come to the conclusion that the solution was 2 :) Daniel Fernandez. Barcelona. 2010/1/24 Schwarz, Barry A : > If the quantity 60 is the supply for 30 days, shouldn't it be 2 per day, not .5 per day? > > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Sdlentertd > Sent: Friday, January 22, 2010 9:19 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Calculations using dates > > Have this dataset > > DeathDT DatePurch DAYSUPPLY QTYPurch PriceUnit > 12/02/2009 11/15/2009 30 60 > 1.00 > > I am trying to find a way to figure out how much money is lost due to > death: > if a person purchased 60units at \$1.00, but died after 16 days of > taking that medication, we have 14 days left (need to calculated the > days left) and need to figure out how much that 14 days is worth > Need to do this in sas: > if death is after datePurchased then do; > Death date minus DatePurch = x; > QTY / DAYSUPPLY =qtyPerDay; > count how many days left after death until DatePurch+Daysupply (to > figure out when the supply expires) = y; > y (days left after death) * qtyPerDay = z; (QTY left after death) > then z* PriceUnit to figure out the final \$ left on medicine after a > person died. > > So in my example: 14 days after death, 0.5 medicine per day = 7qty * > \$1.00 = \$7.00 loss > Thank you > ```

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