**************************************************************************************************** * PROGRAM OVERVIEW **************************************************************************************************** * * PROGRAM: ms_createclaimepi.sas * * Created (mm/dd/yyyy): 07/31/2014 * Last modified: 06/26/2017 * Version: 2.0 * *-------------------------------------------------------------------------------------------------- * PURPOSE: * This program creates episodes of claims with a given tolerence gap between two consecutive * claims. * * Program inputs: * -Dataset containing the claims to create episodes with * Program outputs: * -Dataset containing the created episodes * PARAMETERS: * -infile = Dataset containing the claims to create episodes with * -gap = Maximum allowable gap between two claim (based on Adate Expiredt and EnrStart) * -gaptype = Specifies the type of algorithm to use for the calculation of episode gaps * -outfile= Dataset containing the episodes * * Programming Notes: * * * *-------------------------------------------------------------------------------------------------- * CONTACT INFO: * Mini-Sentinel Coordinating Center * info@mini-sentinel.org * *-------------------------------------------------------------------------------------------------- * CHANGE LOG: * * Version Date Initials Comment (reference external documentation when available) * ------- -------- -------- --------------------------------------------------------------- * 2.0 06/26/17 AP Modified to include a Percentage (P) episode gap * ***************************************************************************************************; %macro ms_createclaimepi(infile=, gaptype=, gap=, outfile=); %put =====> MACRO CALLED: ms_createclaimepi v1.0; Proc sort data=&infile. out=&outfile.; by Patid Adate Expiredt; run; data &outfile.; set &outfile.; by Patid; if first.PatId then do; LRunOutDate=Expiredt; LEnrStart=Enr_Start; LRxSup=RxSup; episode=1; gap=.; end; else do; gap = Adate - LRunOutDate-1; if &gaptype.='F' and (gap > &Gap. or lEnrStart ne Enr_Start) then do; episode=episode+1; LRunOutDate = Expiredt; end; else if &gaptype.='P' and (gap > (&Gap.*LRxSup)/100 or lEnrStart ne Enr_Start) then do; episode=episode+1; LRunOutDate = Expiredt; end; else do; LRunOutDate = max(Expiredt,LRunOutDate); end; end; Group = "&ITGROUP."; format LRunOutDate LEnrStart date9.; LEnrStart = Enr_Start; LRxSup = RxSup; retain episode LRunOutDate LEnrStart LRxSup; run; %put NOTE: ********END OF MACRO: ms_createclaimepi v1.0********; %mend ms_createclaimepi;