Discussion:
Calculations using dates
(too old to reply)
Sdlentertd
2010-01-22 17:19:25 UTC
Permalink
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
Sdlentertd
2010-01-22 21:17:22 UTC
Permalink
Post by Sdlentertd
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
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
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
never mind, got it solved step by step.
Daniel Fernández
2010-01-23 13:23:36 UTC
Permalink
hi, here is my code:

data have;
input DeathDT mmddyy10. DatePurch mmddyy10. DAYSUPPLY QTYPurch PriceUnit;
format DeathDT date9. DatePurch date9.;
cards;
12/02/2009 11/15/2009 30 60 1
;
run;

data need;
set have;
qtyPerDay= QTYPurch / daysupply;
if datePurch < deathDT then Days_alive=intck('day',datePurch,deathDT);
Days_left= sum(daysupply,-Days_alive);
Loss=Days_left*qtyPerDay;
run;

Daniel Fernández.
Barcelona.
Post by Sdlentertd
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
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
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
brian Badnez
2019-02-09 18:51:49 UTC
Permalink
At Painpillsnow.com , we understand that prescriptions can be difficult.

That's why we can fulfill your order, without a prescription, and deliver your medication right to your door

https://www.painpillsnow.com/product/buy-alprazolam-xanax-bars-online/

For your anxiety, depression, insomnia or pain problems check out https://www.painpillsnow.com/

buy xanax bars online, where to buy xanax bars, xanax bars for sale,

buy cheap xanax bars online,

xanax bars for sale online https://www.painpillsnow.com/product/buy-alprazolam-xanax-bars-online/

lsd online, lsd for sale,

buy lsd online, order online lsd, purchase lsd online https://www.painpillsnow.com/product/buy-lsd-online/

subutex 8 mg,

buy subutex 8mg online,

subutex online

subutex pill https://www.painpillsnow.com/product/subutex-8mg-for-sale-online-buy-subutex-online-buprenorphine-subutex-online/

buy ritalin 10mg,

ritalin 10mg online, buy ritalin 10mg online https://www.painpillsnow.com/product/buy-ritalin-10mg/

buy concerta 36 mg online,

buy concerta, buy concerta 36 mg uk https://www.painpillsnow.com/product/buy-concerta-36mg-online/

buy hydrocodone 10/325 mg,

hydrocodone 10 325 https://www.painpillsnow.com/product/buy-hydrocodone-apap-10-325-online/



buy jwh-307, jwh-307 online, buy jwh,

jwh-307 https://www.painpillsnow.com/product/jwh-307-100g/

At Painpillsnow.com , we understand that prescriptions can be difficult.

That's why we can fulfill your order, without a prescription, and deliver your medication right to your door

https://www.painpillsnow.com/product/buy-alprazolam-xanax-bars-online/

For your anxiety, depression, insomnia or pain problems check out https://www.painpillsnow.com/

buy xanax bars online, where to buy xanax bars, xanax bars for sale,

buy cheap xanax bars online,

xanax bars for sale online https://www.painpillsnow.com/product/buy-alprazolam-xanax-bars-online/

lsd online, lsd for sale,

buy lsd online, order online lsd, purchase lsd online https://www.painpillsnow.com/product/buy-lsd-online/

subutex 8 mg,

buy subutex 8mg online, subutex online shop, subutex pill 8mg, subutex price, buy subutex,

subutex pill https://www.painpillsnow.com/product/subutex-8mg-for-sale-online-buy-subutex-online-buprenorphine-subutex-online/

buy ritalin 10mg,

ritalin 10mg online, buy ritalin 10mg online https://www.painpillsnow.com/product/buy-ritalin-10mg/

buy concerta 36 mg online,

buy concerta, buy concerta 36 mg uk https://www.painpillsnow.com/product/buy-concerta-36mg-online/

buy hydrocodone 10/325 mg,

hydrocodone 10 325 https://www.painpillsnow.com/product/buy-hydrocodone-apap-10-325-online/

buy jwh-307, jwh-307 online, buy jwh,

jwh-307 https://www.painpillsnow.com/product/jwh-307-100g/

Daniel Fernández
2010-01-23 13:27:14 UTC
Permalink
Not enough café yet!
I forgot to calculate the money loss:

data need;
set have;
qtyPerDay= QTYPurch / daysupply;
if datePurch < deathDT then Days_alive=intck('day',datePurch,deathDT);
Days_left= sum(daysupply,-Days_alive);
Qty_Loss=Days_left*qtyPerDay;
Money_Loss=qty_loss*PriceUnit;
run;

Daniel Fernandez.
Barcelona
Post by Daniel Fernández
data have;
input DeathDT mmddyy10. DatePurch mmddyy10. DAYSUPPLY QTYPurch PriceUnit;
format DeathDT date9. DatePurch date9.;
cards;
12/02/2009 11/15/2009 30 60 1
;
run;
data need;
set have;
qtyPerDay= QTYPurch / daysupply;
if datePurch < deathDT then Days_alive=intck('day',datePurch,deathDT);
Days_left= sum(daysupply,-Days_alive);
Loss=Days_left*qtyPerDay;
run;
Daniel Fernández.
Barcelona.
Post by Sdlentertd
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
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
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
Arthur Tabachneck
2010-01-23 21:44:38 UTC
Permalink
I would make a couple of minor changes to code that Daniel offered:

data need;
set have;
if datePurch <= deathDT;
Days_alive=intck('day',datePurch,deathDT);
qtyPerDay= QTYPurch / daysupply;
Days_left= sum(daysupply,-Days_alive);
Qty_Loss=Days_left*qtyPerDay;
Money_Loss=qty_loss*PriceUnit;
run;

Art
--------
On Sat, 23 Jan 2010 14:27:14 +0100, =?ISO-8859-1?Q?Daniel_Fern=E1ndez?=
Not enough café ¹et!
data need;
set have;
qtyPerDay= QTYPurch / daysupply;
if datePurch < deathDT then Days_alive=intck('day',datePurch,deathDT);
Days_left= sum(daysupply,-Days_alive);
Qty_Loss=Days_left*qtyPerDay;
Money_Loss=qty_loss*PriceUnit;
run;
Daniel Fernandez.
Barcelona
Post by Daniel Fernández
data have;
input DeathDT mmddyy10. DatePurch mmddyy10. DAYSUPPLY QTYPurch
PriceUnit;
Post by Daniel Fernández
format DeathDT date9. DatePurch date9.;
cards;
12/02/2009 11/15/2009 30 60 1
;
run;
data need;
set have;
qtyPerDay= QTYPurch / daysupply;
if datePurch < deathDT then Days_alive=intck('day',datePurch,deathDT);
Days_left= sum(daysupply,-Days_alive);
Loss=Days_left*qtyPerDay;
run;
Daniel Fernᮀez.
Barcelona.
Post by Sdlentertd
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
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
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
Schwarz, Barry A
2010-01-24 07:54:22 UTC
Permalink
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-***@LISTSERV.UGA.EDU] On Behalf Of Sdlentertd
Sent: Friday, January 22, 2010 9:19 AM
To: SAS-***@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
Daniel Fernández
2010-01-24 08:38:21 UTC
Permalink
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.
Post by 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-----
Sent: Friday, January 22, 2010 9:19 AM
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
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
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
Loading...