A SAS® Macro Program to Calculate Medication Adherence Rate for Single and Multiple Medication Use Li-Hao Chu, Kaiser Permanente, Pasadena, CA Aniket Kawatkar, Kaiser Permanente, Pasadena, CA Annie Gu, UnitedHealth Group, Cypress, CA ABSTRACT Different medication adherence measurements have been developed as a result of the complexity of medication consumption and different study designs. After an extensive review of methods applied in pharmacy related administrative databases, we found that Medication Possession Ratio (MPR) and Proportion Days Covered (PDC) are the two most common measurements used in pharmacoepidemiological and pharmacoeconomic studies and are also recommended by the International Society for Pharmacoeconomics and Outcomes Research (ISPOR). This paper summarizes and presents a SAS macro program that covers different metrics for calculating medication adherence rate for single medication and multiple medication use. The results will allow clinicians and researchers to compare and select a metric that fits best to their research interest.

INTRODUCTION Improving poor medication adherence has become an urgent task as healthcare costs continue to outpace economic growth. Poor adherence to medication has been reported to cost more than 100 billion dollars each year on avoidable hospitalizations (Osterberg and Blaschke 2005). Up to 89,000 premature deaths were related to non-adherence to antihypertensive treatments (Cutler, Long et al. 2007). These studies show a high correlation between poor medication adherence and skyrocketing healthcare cost as well as worsening quality of care. To start improving medication adherence, a standardized and convenient approach to quickly identify non-adherent patients is essential in coordinating intervention efforts and focusing our healthcare resources at the population that needs it most. Using pharmacy administrative data to assess medication adherence has been a popular approach for large population studies. The advantages include that the information is intuitive and have real-time availability in most cases. Usually errors in database are limited because a record won’t be processed unless the required fields are input correctly (Leslie 2008). These features make pharmacy administrative data a great source for medication adherence rate calculation. Now the next question is what standardized measures can best meet the requirements for different type of studies and a variety of ways of medication use. With a comprehensive literature review and discussion by the Medication and Compliance Special Interest Group of International Society for Pharmacoeconomics and Outcomes Research (ISPOR), medication possession ratio (MPR) and proportion days covered (PDC) are 2 measurements being proposed and defined for calculating medication adherence rate (Peterson, Nau et al. 2007). The SAS macro we developed allows user to choose between these 2 measurements and also provides results for the variants of these two measurements that have been applied in different type of studies.

MPR AND PDC The calculation of MPR is calculated as the sum of the days supplied for all medications and then is divided by a set of period of time (Steiner and Prochazka 1997). The concept of MPR is easy to understand and program, and is mainly used for single medication use. One important feature of MPR is that it totals days of supply from all medication records. As a result, it double counts the days when patients refill their medication before the previous prescription runs out. This is a reasonable estimate when considering the double counting as shifting the overlapping days forward. However, when treatment includes more than one drug or possible overdosing, the overlapping days may indicate a switch of drugs or an early exhaustion of previous medication and should not be double counted. Under this circumstance, MPR is likely to overestimate the medication adherence. An alternative to MPR is PDC, which is the number of days with drug on hand in a period of time (Benner, Glynn et al. 2002). It avoids double counting days when two refills overlap. PDC takes into account only whether there are medications available on that day or not, rather than the number of medications. In MPR, however, the overlapping

1

days are counted as the number of available dispensing records. Even though PDC may underestimate the adherence rate in cases like refilling the medication before it runs out, it prevents over counting days in situations like switching between medications and therapeutic duplication (augmentation) (Martin, Wiley-Exley et al. 2009). A SAS program for calculating MPR and PDC for single medication use with a fixed follow-up period has been introduced in Leslie’s paper (Leslie 2008), and is designed for a longitudinal study. A cross sectional study in which the data are collected in a fixed time interval is not covered yet. Besides different study designs, termination or switching of treatment, and the expiration of drug benefit coverage are factors that may need to be considered in the calculation. Therefore, measurements like a prescription-based metric which has the variant like last refill included or last refill excluded are introduced here, too. For the detailed comparison between MPR and PDC and their variants please see figure 1. Figure 1 Comparison between Medication Possession Ratio and Proportion Days Covered

Medication Possession Ratio Interval Based or a fixed follow up time (Type I)

Prescription Based (Include Last Fill:Type II)

Prescription Based (Exclude Last Fill: Type III)

Proportion Days Covered

Total Rx Days of Supply Days of Follow Up =

Total Days Drug Available Days of Follow Up

( AB+CD+ EF +GZ ) 43 = =1* AZ 40

=

Total Rx Days of Supply Last Rx Date − First Rx Date + Last Rx Days Supply

=

( AB + CD + EF + GH ) 50 = =1 * 47 AH

( AB + CD + EG + GZ ) 40 = AZ 40

Total Days Drug Available Last Rx Date − First Rx Date + Last Rx Days Supply =

( AB + CD + EG + GH ) 47 = AH 47

Total Rx Days of Supply − Days of Supply of Last Rx Last Rx Date − First Rx Date

Total Days Drug Available− Days of Supply of Last Rx Last Rx Date − First Rx Date

( AB + CD + EG −1) 32 = 32 AG −1

=

( AB + CD + EG −1) 32 = 32 AG −1

*: Truncate to 1if the value is greater than 1. Both the MPR and the PDC have pros and cons and the decision has to be based on the study purpose and types of medication use. In general, MPR can be a good choice for single medication use with frequent early refills; while PDC, which is less sensitive to the treatment pattern changes where medications can be switched, added and discontinued can give a more accurate estimate for multiple medication use.

2

CONCURRENT ADHERENCE Even though medication adherence rates have been largely applied in single medication use, concurrent medication adherence, a measurement of multiple classes of medication consumption still remains as an unexplored territory. A paper published by Choudhry’s team proposed 3 distinct ways for measuring concurrent adherence (Choudhry, Shrank et al. 2009). The first approach is to calculate prescription-based PDC for each class of medication in each patient, and averages the PDC at patient level. The second approach is to calculate the number of days during which patients have at least 1 medication available beginning from the first day of their prescription until the last refill. In other words, all the medications are treated exchangeable in this metric. The third approach is to first calculate the PDC for each class of medication, and compliance is defined only when all the classes of medications exceed the specified threshold of medication adherence rate. For instance, for patients treated with 2 different medications for the same condition, only when both medication adherences are greater than 80% can a patient be considered as adherent. Figure 2 Different metrics for concurrent adherence

Interval Based

Prescription Based

Type I: Average PDC

 ( PDC (ClassI )+ PDC (ClassII ))

(

( AB +CD + EG +GZ ) AH

+

( ac + cd + eZ ) ) /2 af

(

( AB + CD + EG + GH ) AH

+

( ac +cd +ef ) ) /2 af

Number of Class

Type II : Proportion of days with >=1 Medication available Type III : Proportion of patients with PDC >= 80% for all Medications

( Aa + aC + Cc + cE + EG + GZ ) AZ ( AB +CD + EG +GZ ) AH

> 0.8 and

( ac +cd +eZ ) >0.8 af

3

( Aa + aC +Cc +cE + EG +GH ) AH ( AB + CD + EG + GH ) AH

>0.8 and

( ac +cd +ef ) >0.8 af

PRESENTATION OF CODE Prior to running this macro, some preparation work has to be done when pulling the data from pharmacy administrative data. Depending on the type of study (longitudinal or cross sectional) there are different ways to create a study cohort. For a longitudinal study, a follow up period needs to be specified and the date range for data collection is usually limited between the earliest refill date and an end date which is the earliest date plus the follow up days. For a cross sectional study, the data collection is limited between a fixed time window, e.g., 1/1/2005 to 12/31/2005. The key variables to keep during data preparation are study id, refill date, days of supply, and class of medications. Another thing to be mindful is the use of CLASS parameter. For single medication use which has the same generic or brand name across all the records, medication name can be used for CLASS. When dealing with multiple exchangeable medications, the variable used for CLASS parameter should contain one single unified value. In other words, this scenario should be treated as single medication use.

STEP ONE A call to this macro program needs to have the following key parameters being defined first. DATAIN is for the source data. DATAOUT is the name for final output file. ID is for patient id. FILLDT is for refill date or dispense date. DAYSUP is for days of supply. CLASS is class of medications. IBENDT is the end date of a fixed interval and needs to be input in a date9 format like 01Jun2011. The default is missing. FP is the follow up time which can be any positive integer and the default is missing. Either IBENDT or FP has to be specified to run this MEDAD macro. TYPE is input as MPR or PDC, DECPCT is the number of decimal point which can be 1 – 4, and DEBUG is the choice for debugging process and the input value is Y or N. %MACRO MEDAD(lib=, datain=, dataout=, id=, filldt=, daysup=, class=, ibendt=., fp=., type=, decpct=2, debug=N); The first step in macro is to make sure each dispense record is unique, and then define the earliest refill date as INDEX_DT and the latest refill date as LSTRX_DT for each class of medication during the study period /***Remove duplicate dispense record***/ PROC SORT DATA=&lib..&datain. nodupkey out=&datain._dedup; BY &id. &class. &filldt.; RUN; /***Identify first dispense record and last dispense record***/ PROC SQL; CREATE TABLE RXCLM AS SELECT &ID., &FILLDT., &CLASS., MIN(&FILLDT.) AS INDEX_DT FORMAT=MMDDYY10., MAX(&FILLDT.) AS LSTRX_DT FORMAT=MMDDYY10., &DAYSUP. FROM &DATAIN._DEDUP GROUP BY &ID., &CLASS. ORDER BY &ID., &CLASS., &FILLDT.; QUIT;

STEP TWO Medication adherence rate is not meaningful when there is only one dispense record. Therefore, cases with only one dispense record is moved to data set named ONERX at this step. /**Create a dataset that contains case with one dispense record only**/ DATA ONERX RXCLM1; SET RXCLM END=EOF1; BY &ID. &CLASS.; IF FIRST.&CLASS. AND LAST.&CLASS. THEN OUTPUT ONERX; ELSE OUTPUT RXCLM1; RUN;

STEP THREE To accommodate different metrics in the program, different study end dates are created at this step. A cross sectional study is featured by a fixed time interval. Parameter IBENDT which represents the end date of a study period needs to be specified in a date9 format like 01Jun2011. The default value of IBENDT is missing. A follow up time needs to be specified in parameter FP in a longitudinal type of study. The end date of each refill record is created at this step.

4

/**Create end date for each dispense record and for the end of study period**/ DATA MAXEND; SET RXCLM1; %IF &IBENDT ^=. %THEN %DO; IB_END = (input("&IBENDT.",date9.)) ; /*Cross sectional*/ %END; %ELSE %IF &FP.^=. %THEN %DO; IB_END = INDEX_DT + &FP. -1; %END;/*Longitudinal*/ FILL_END_DT = &FILLDT. +&DAYSUP. - 1 ; END_DT=MAX(OF IB_END FILL_END_DT); FORMAT END_DT IB_END MMDDYY10.; RUN;

STEP FOUR 2 macro variables are created in PROC SQL step to represent the study start date (start) and study end date (term). In DATA step, array FLAG and first DO loop creates dummy variables to cover days spanning from the earliest dispensing date (start) to the latest dispensing date (term) across all the records, and the value is set to 0. Second DO loop flags the days from refill date to the end date in each dispensing record, and set the value to 1. In other words, this step flags days that have medication available in each dispense record. /**Create macro for the earliest start date and latest end date**/ PROC SQL; SELECT MIN(INDEX_DT), MAX(END_DT) INTO :START, :TERM FROM MAXEND; QUIT; /**Create dummy var to represent days in study period and flag dummy as 1 if medication is available**/ DATA AD_1; ARRAY FLAG(&START. :&TERM. ); SET MAXEND; BY &ID. &CLASS.; DO I= &START. to &TERM.; FLAG(I)=0; END; /* move through the days covered */ DO U=&FILLDT. to FILL_END_DT; FLAG(U)=1; END; DROP I U; RUN;

STEP FIVE This step is to create a macro variable to represent an interval between the earliest start date and the latest end date. %LET INTRL= %EVAL(&TERM. - &START. +1); %PUT &INTRL;

STEP SIX A Dow-loop (Dorfman 2010) is applied here to vertically sum up the flagged days in each dispensing record within each class. To avoid over counting medications that are present in the same day across different dispensing records, a do-loop is coded here to convert value greater than 1 to 1 in PDC measurement. /***Summarize the flagged days in the last record of each class***/ DATA AD_2; DO UNTIL (LAST.&CLASS.);

5

SET AD_1; BY &ID. &CLASS.; ARRAY FLAG(&INTRL.) FLAG1-FLAG&INTRL.; ARRAY SUMFLAG(&INTRL.); DO I=1 TO &INTRL.; SUMFLAG(I) = SUM(SUMFLAG(I), FLAG(I)); END; END; %IF %UPCASE(&TYPE)=PDC %THEN %DO; DO U=1 TO &INTRL.; IF SUMFLAG(U) GE 1 THEN SUMFLAG(U)=1; ELSE SUMFLAG(U)=0; END; %END; DROP I FLAG:; RUN;

STEP SEVEN This is the step to create numerators and denominators for calculating MPR or PDC. AD_2 data from step six contains a span of days (dummy variables) which are flagged as 1 if it is within the medication coverage of that dispensing record. It is possible that the end of refill date can exceed the study end date. An arrayend variable is created to specify the end of each counting process, and then a do-loop is used to sum up the flagged days from the first dummy variable till arrayend for numerator. For a prescription-based measurement, if the last refill is included, the numerator is simply the sum of all the flagged days, and the denominator covers the period from index date to the end date of last refill. If the last refill is excluded, the numerator is the sum of flagged days from index date to the day before last refill starts, and the denominator covers the period from index date to the day before last refill starts. /**Adjust the end date based off the types of measurements***/ DATA &DATAOUT.; SET AD_2; ARRAY TAT(&INTRL.) SUMFLAG1 - SUMFLAG&INTRL.; *--Interval based metric; IF IB_END =. THEN &TYPE._1=.; ELSE DO; NUM1=0; ARRAYEND=IB_END - &START. + 1; DO H=1 TO ARRAYEND; NUM1= TAT(H)+ NUM1; END; DENO1= IB_END - INDEX_DT +1; &TYPE._1 = ROUND(MIN((NUM1/DENO1),1), &decpct.); END; /**Rx based including last refill**/ NUM2= SUM(OF SUMFLAG1-SUMFLAG&INTRL.); DENO2=FILL_END_DT - INDEX_DT +1; &TYPE._2 = ROUND(MIN((NUM2 /DENO2),1), &decpct.); /**Rx based excluding last refill**/ NUM3= SUM(OF SUMFLAG1-SUMFLAG&INTRL.) - (&DAYSUP.); DENO3= &FILLDT. - INDEX_DT; &TYPE._3 = ROUND(MIN((NUM3 /DENO3),1), &decpct.); KEEP &ID. &CLASS. &TYPE.: ; FORMAT FILL_END_DT MMDDYY10.; RUN;

6

FINAL OUTPUT The final result in the output data file contains study ID, class of medications and either MPR_1, MPR_2 and MPR_3 or PDC_1, PDC_2 and PDC_3. MPR and PDC is specified by type parameter in macro call statement, and the suffix number 1, 2 and 3 corresponds to metrics for interval based/fixed follow up, prescription-based with last refill included and prescription-based with last refill excluded. Please use figure 1 as the reference for 3 different metrics.

CONCURRENT ADHERENCE As proposed by Choudhry et all (Choudhry, Shrank et al. 2009), there are three distinct ways to define concurrent adherence. The first approach is type I in figure 2 and it calculates the average of medication adherence rate for each class of medication, and then averages them to patient level. MEDAD macro provides the calculation of average medication adherence rate at class level. Hence, to get the concurrent adherence rate in patient level, you can continue with DATAOUT file, and average them in patient level. An example code is shown below. /****Average PDC*****/ PROC SQL; CREATE TABLE AD5 AS SELECT MRN, ROUND((SUM(PDC_1) / COUNT(MRN)), 0.01) AS AVG_PDC_1 /* ROUND((SUM(PDC_2) / COUNT(MRN)), 0.01) AS AVG_PDC_2,*/ /* ROUND((SUM(PDC_3) / COUNT(MRN)), 0.01) AS AVG_PDC_3*/ FROM DATAOUT /*Replace the DATAOUT to its actual name*/ GROUP BY MRN ; QUIT; DATA AD6; SET AD5; /** 0.8 is the adherence threshold defined by study **/ IF AVG_PDC_1 < 0.8 THEN COMPLIANCE=0; ELSE COMPLIANCE=1; RUN;

The second type is to calculate the number of days during which patients have at least 1 medication available beginning from the first day of their prescription until the last refill. It can be done through MEDAD macro without additional steps. To carry out this measurement is to treat all the medications exchangeable and assign a single unified value to a variable that is later used in CLASS parameter. The final result in DATAOUT file is the medication adherence rate at patient level. The third type approach is to define an adherent case as having every class of medication exceeds a specified compliance threshold. DATAOUT file from MEDAD macro program provides medication adherence rate at class level for each patient. The code below transposes DATAOUT and presents medication adherence rate of each class of medication with prefix pdc_1_ horizontally. Next, the DATA step defines adherence by conditioning on minimum value of adherence rate of each medication to be greater than the specified threshold. Colon in pdc_1_ : is used as a variable name wildcard to cover all the medication adherence rates transposed in the earlier step. /*****Scan through all PDC from different classes****/ proc transpose data=DATAOUT out=pdc_w (drop=_name_) prefix=pdc_1_; by mrn; var pdc_1; run; DATA AD6; set pdc_w; IF MIN(OF pdc_1_: ) < 0.8 THEN COMPLIANCE=0; ELSE COMPLIANCE=1; RUN;

CONCLUSION As medication adherence takes center stage in better improving quality of care and reducing health care costs, a program that can offer the flexibility to compute medication adherence rates for different type of studies and for different medication use is increasingly important. This SAS macro covers measurements for MPR and PDC and 3 variants for each kind. Example code is also provided to measure concurrent adherence in the end. We hope that this macro that can further facilitate the progress of improving medication adherence.

7

REFERENCES 1.

Benner, J. S., R. J. Glynn, et al. (2002). "Long-term persistence in use of statin therapy in elderly patients." JAMA : the journal of the American Medical Association 288(4): 455-461.

2.

Choudhry, N. K., W. H. Shrank, et al. (2009). "Measuring concurrent adherence to multiple related medications." The American journal of managed care 15(7): 457-464.

3.

Cutler, D. M., G. Long, et al. (2007). "The value of antihypertensive drugs: a perspective on medical innovation." Health affairs 26(1): 97-110.

4.

Dorfman, P. M. (2010). "The DOW-Loop Unrolled." Proceedings of the 22th Annual Northeast SAS Users Group (NESUG) Regional Conference, 2008.

5.

Leslie, S. G.-S., Femida; Thiebaud, Patrick; Patel, Bimal (2008). "Calculating medication compliance, adherence and persistence in administrative pharmacy claims databases." Pharmaceutical Programming 1(1): p13-19.

6.

Martin, B. C., E. K. Wiley-Exley, et al. (2009). "Contrasting measures of adherence with simple drug use, medication switching, and therapeutic duplication." The Annals of pharmacotherapy 43(1): 36-44.

7.

Osterberg, L. and T. Blaschke (2005). "Adherence to medication." The New England journal of medicine 353(5): 487-497.

8.

Peterson, A. M., D. P. Nau, et al. (2007). "A checklist for medication compliance and persistence studies using retrospective databases." Value in health : the journal of the International Society for Pharmacoeconomics and Outcomes Research 10(1): 3-12.

9.

Steiner, J. F. and A. V. Prochazka (1997). "The assessment of refill compliance using pharmacy records: methods, validity, and applications." Journal of clinical epidemiology 50(1): 105-116.

ACKNOWLEDGMENTS The author would like to thank Annie Gu, an associate director from UnitedHealth Group, Aniket Kawatkar, a research scientist from Kaiser Permanente and Brenda Beaty from University of Colorado Health Sciences Center for their review and feedback, and Leslie Scott from MedImpact Healthcare Systems for his discussion.

CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the author at: Name: Li-Hao Chu Enterprise: Kaiser Permanente Address: 100 S. Los Robles Ave., 2nd Floor, Pasadena, CA 91101 Work Phone: 626-564-3980 E-mail: [email protected]

SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. Other brand and product names are trademarks of their respective companies.

8

APPENDIX %MACRO MEDAD(lib=, datain=, dataout=, id=, filldt=, daysup=, class=, ibendt=., fp=., type=, decpct=2, debug=N); %let debug=%upcase(&debug); %if (&debug=Y) %then %do; options mprint mtrace macrogen notes linesize=132 ps=58; %end; %else %do; options nonotes nomprint nomacrogen nomtrace nosymbolgen nomlogic linesize=132 ps=58; %end; %if %sysfunc(exist(&lib..&datain.))=0 %then %do; %put ERROR: DATA SET &datain. DOES NOT EXIST.; %put ERROR- MACRO WILL TERMINATE NOW.; %return; %end; %if %if %if %if %if

(&decpct=4) (&decpct=3) (&decpct=2) (&decpct=1) (&decpct=)

%then %then %then %then %then

%let %let %let %let %let

decpct=0.0001; decpct=0.001; decpct=0.01; decpct=0.1; decpct=1;

/***Step 1***/ /***Remove duplicate dispense record***/ PROC SORT DATA=&lib..&datain. nodupkey out=&datain._dedup; BY &id. &class. &filldt.; RUN; /***Identify first dispense record and last dispense record***/ PROC SQL; CREATE TABLE RXCLM AS SELECT &ID., &FILLDT., &CLASS., MIN(&FILLDT.) AS INDEX_DT FORMAT=MMDDYY10., MAX(&FILLDT.) AS LSTRX_DT FORMAT=MMDDYY10., &DAYSUP. FROM &DATAIN._DEDUP GROUP BY &ID., &CLASS. ORDER BY &ID., &CLASS., &FILLDT.; QUIT; /***Step 2***/ /**Create a dataset that contains case with one dispense record only**/ DATA ONERX RXCLM1; SET RXCLM END=EOF1; BY &ID. &CLASS.; IF FIRST.&CLASS. AND LAST.&CLASS. THEN OUTPUT ONERX; ELSE OUTPUT RXCLM1; RUN; /***Step 3***/ /**Create end date for each dispense record and for the end of study period**/ DATA MAXEND; SET RXCLM1; %IF &IBENDT ^=. %THEN %DO; IB_END = (input("&IBENDT.",date9.)) ; /*Cross sectional*/

9

%END; %ELSE %IF &FP.^=. %THEN %DO; IB_END = INDEX_DT + &FP. -1; %END;/*Longitudinal*/ FILL_END_DT = &FILLDT. +&DAYSUP. - 1 ; END_DT=MAX(OF IB_END FILL_END_DT); FORMAT END_DT IB_END MMDDYY10.; RUN; /***Step 4***/ /**Create macro for the earliest start date and latest end date**/ PROC SQL; SELECT MIN(INDEX_DT), MAX(END_DT) INTO :START, :TERM FROM MAXEND; QUIT; /**Create dummy var to represent days in study period and flag dummy as 1 if it has drug avaiable**/ DATA AD_1; ARRAY FLAG(&START. :&TERM. ); SET MAXEND; BY &ID. &CLASS.; DO I= &START. to &TERM.; FLAG(I)=0; END; /* move through the days covered */ DO U=&FILLDT. to FILL_END_DT; FLAG(U)=1; END; DROP I U; RUN; /***Step 5***/ %LET INTRL= %EVAL(&TERM. - &START. +1); %PUT &INTRL; /***Step 6***/ /***Summarize the flagged days in the last record of each class***/ DATA AD_2; DO UNTIL (LAST.&CLASS.); SET AD_1; BY &ID. &CLASS.; ARRAY FLAG(&INTRL.) FLAG1-FLAG&INTRL.; ARRAY SUMFLAG(&INTRL.); DO I=1 TO &INTRL.; SUMFLAG(I) = SUM(SUMFLAG(I), FLAG(I)); END; END; %IF %UPCASE(&TYPE)=PDC %THEN %DO; DO U=1 TO &INTRL.; IF SUMFLAG(U) GE 1 THEN SUMFLAG(U)=1; ELSE SUMFLAG(U)=0; END; %END;

10

DROP I FLAG:; RUN; /***Step 7***/ /**Adjust the end date based off the types of measurements***/ DATA &DATAOUT.; SET AD_2; ARRAY TAT(&INTRL.) SUMFLAG1 - SUMFLAG&INTRL.; *--Interval based metric; IF IB_END =. THEN &TYPE._1=.; ELSE DO; NUM1=0; ARRAYEND=IB_END - &START. + 1; DO H=1 TO ARRAYEND; NUM1= TAT(H)+ NUM1; END; DENO1= IB_END - INDEX_DT +1; &TYPE._1 = ROUND(MIN((NUM1/DENO1),1), &decpct.); END; /**Rx based including last refill**/ NUM2= SUM(OF SUMFLAG1-SUMFLAG&INTRL.); DENO2=FILL_END_DT - INDEX_DT +1; &TYPE._2 = ROUND(MIN((NUM2 /DENO2),1), &decpct.); /**Rx based excluding last refill**/ NUM3= SUM(OF SUMFLAG1-SUMFLAG&INTRL.) - (&DAYSUP.); DENO3= &FILLDT. - INDEX_DT; &TYPE._3 = ROUND(MIN((NUM3 /DENO3),1), &decpct.); KEEP &ID. &CLASS. &TYPE.: ; FORMAT FILL_END_DT MMDDYY10.; RUN;

%MEND;

11