Date: Sat, 23 Jan 2010 23:54:22 0800
ReplyTo: "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Sender: "SAS(r) Discussion" <SASL@LISTSERV.UGA.EDU>
From: "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Subject: Re: Calculations using dates
InReplyTo: <2fa971d9f6f947f6b951d16af40ca447@a6g2000yqm.googlegroups.com>
ContentType: text/plain; charset="usascii"
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:SASL@LISTSERV.UGA.EDU] On Behalf Of Sdlentertd
Sent: Friday, January 22, 2010 9:19 AM
To: SASL@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
