**************************************************************************************************** * PROGRAM OVERVIEW **************************************************************************************************** * * PROGRAM: ms_extractdeaths.sas * * Created (mm/dd/yyyy): 07/31/2014 * Last modified: 07/31/2014 * Version: 1.0 * *-------------------------------------------------------------------------------------------------- * PURPOSE: * This program pre extracts deaths and death encounters. * * Program inputs: * -dataset containing deaths to extract records from * -dataset containing encounters to extract records from * * Program outputs: * -dataset containing the extracted death records * * PARAMETERS: * -deathfile = Name of the dataset containing deaths to extract records from * -encounterfile = Name of the dataset containing encounters to extract records from * -outfile = Name of the output dataset containing the extracted records * * Programming Notes: * * * *-------------------------------------------------------------------------------------------------- * CONTACT INFO: * Mini-Sentinel Coordinating Center * info@mini-sentinel.org * *-------------------------------------------------------------------------------------------------- * CHANGE LOG: * * Version Date Initials Comment (reference external documentation when available) * ------- -------- -------- --------------------------------------------------------------- * mm/dd/yy * ***************************************************************************************************; %MACRO ms_extractdeaths(deathfile=,encounterfile=,outfile=); %put =====> MACRO CALLED: ms_extractdeaths v1.0; * Extraction of deaths encounters; data _DeathEnc; format DeathDt date9.; set &encounterfile.; where upcase(Discharge_Status)="EX"; DeathDt=Coalesce(DDate,ADate); keep PatId DeathDt; run; %ISDATA(dataset=&deathfile.); %IF %EVAL(&NOBS.>0) %THEN %DO; data &outfile.; retain PatId DeathDt; format DeathDt date9.; set _DeathEnc &deathfile.(where=(upcase(Confidence)="E") keep=PatId DeathDt Confidence); keep PatId DeathDt; run; %END; %ELSE %DO; data &outfile.; retain PatId DeathDt; set _DeathEnc; run; %END; proc means data= &outfile. nway noprint; var DeathDt; class PatId; output out=&outfile. (drop=_:) min=; run; %put NOTE: ********END OF MACRO: ms_extractdeaths v1.0********; %MEND ms_extractdeaths;