|
This is a bit clearer. You have explained what is compliance between refills
but it is still not clear whether the patient taking the medication can be
considered compliant if he/she meets the compliance criteria only 5 times in
10 refills.
From my understanding of the problem the ratio can be easily calculated with
a lag function or something that is the equivalent of it. See if this what
you have in mind.
data prescriptions ;
input id date : mmddyy. days num ;
format date mmddyys8. ;
cards ;
1 2/6/06 30 0
1 3/6/06 30 1
2 2/6/06 30 0
2 3/6/06 30 1
2 4/6/06 30 2
3 2/6/06 30 0
3 4/9/06 30 1
3 7/9/06 30 2
3 8/9/06 30 3
3 10/12/06 30 4
3 12/6/06 30 5
run ;
options validvarname = v7 ;
data compliance ;
if not last.id then _n_ = date ;
set prescriptions ;
by id ;
ratio = days / (date - _n_) ;
if ratio > .80 then compliance = 1 ;
run ;
Obs date id days num ratio compliance
1 02/06/06 1 30 0 0.00178 .
2 03/06/06 1 30 1 1.07143 1
3 02/06/06 2 30 0 0.00178 .
4 03/06/06 2 30 1 1.07143 1
5 04/06/06 2 30 2 0.96774 1
6 02/06/06 3 30 0 0.00178 .
7 04/09/06 3 30 1 0.48387 .
8 07/09/06 3 30 2 0.32967 .
9 08/09/06 3 30 3 0.96774 1
10 10/12/06 3 30 4 0.46875 .
11 12/06/06 3 30 5 0.54545 .
Venky Chakravarthy.
On Fri, 31 Mar 2006 09:57:22 -0800, sam <sghate@GMAIL.COM> wrote:
>Thanks for your prompt replies. I appreciate that. One of the reply to
>my question was to give details about the ratio that I want to
>calculate and would it be possible to calcualte the ratio without
>converting multiple lines of data to a single line.
>
>To make it more clear the above database is a prescription claims
>database. The variable date denotes the data the prescription was
>filled and the variable days is the number of days of supply of the
>medication.
>
>The ratio i want to calculate is to find out the compliance of patients
>taking the medications.
>
>compliance= days supply of medication /(second fill date (date2) -
>first fill date (date1) )
>
>Subjects with a ratio of >= 0.80 would have high compliance.
|