—••—
/******************************************************************/
/*Calculate the Compliance Ratio:                                 */
/*  Number of Days=FirstDateFilled-LastDateFilled                 */
/*  Total Days Supply=sum of DaysSupply-lastDaysSupply            */
/*  CR=(Number of Days/Total Days Supply)                         */
/******************************************************************/
data acearb.drugcomplianceratio (drop=dayssupply quantity datefilled)
     acearb.drugonescript (drop=dayssupply quantity datefilled cr);
  set acearb.drugnoswitch;
  by personid;
/******************************************************************/
/*Negative numbers treated as 1 positive number                   */
/******************************************************************/
    if dayssupply<1 then dayssupply=(.z<dayssupply<0);
      if first.personid then TDaysSupply=0;
	    tdayssupply+dayssupply;
	  if last.personid;
	    Days=intck('days', firstfilled, lastfilled);
		  if days=0
		    then do;
			  output acearb.drugonescript;
		  end;
		  else do;
	        CR=round(days/(tdayssupply-ds), .01);
			output acearb.drugcomplianceratio;
		  end;
  format
    firstfilled mmddyy10.
	lastfilled mmddyy10.;
  informat
    firstfilled mmddyy10.
	lastfilled mmddyy10.;
run;

/******************************************************************/
/*Generate compliance ratio report                                */
/******************************************************************/
proc sort data=acearb.drugcomplianceratio out=drugcomplianceratio;
  by personid;
run;

proc means data=drugcomplianceratio noprint;
  by personid;
  id gender;
  var bene;
  output out=t1
         sum=t1member;
run;

proc sort data=drugcomplianceratio;
  by personid brandname;
run;

proc means data=drugcomplianceratio noprint;
  by personid;
  id brandname;
  var cr;
  output out=t2
         sum=t2cr;
run;

data total;
  merge t1
        t2;
  by personid;
    if t1member<1 then t1member=0;
	if t2cr<1 then t2cr=0;
	  tcr=t2cr;
run;

ods html body='c:\DrugComplianceRatio.html'
  style=minimal
  rs=none;

proc report data=total headline headskip spacing=2 missing nowd split='*';
	column brandname t1member, (gender) _freq_ total1 t2cr, (gender) tcr total2;
  define brandname/group width=31 'Drug Prescribed';
  define t1member/sum width=10 format=comma10. 'Total*Members';
  define _freq_/sum noprint;
  define total1/computed width=10 format=comma10. 'Total';
  define t2cr/sum width=10 format=comma10.2 'Total*Compliance*Ratio';
  define tcr/sum noprint;
  define total2/computed width=10 format=comma10.2 'Total';
  define gender/across width=7 format=$fmtsex. 'Gender';
  compute total1;
    total1=_freq_.sum;
  endcomp;
  compute total2;
   total2=tcr.sum;
  endcomp;
rbreak after/ol ul skip suppress summarize;
run;

ods html close;
				
BackToTop • BackToDocument • HomePage

Copyright © 2002-2004 www.nycinformatics®.com All Rights Reserved
Last edited on: January 30, 2004

SAS product or service names are registered trademarks of SAS Institute, Inc. in the USA and other countries.
® indicates USA registration.