Note: This program was developed on a 32-bit Windows system.
* ---------------------------------------------------------------------------- ;
* Our master file is based on our study enrollment form. Our initital cohort ;
* consists of 200 participants. This program will identify which subjects are ;
* missing subsequent forms. To properly assess this, we must also identify ;
* which subjects have passed away since study enrollment and thus exclude them ;
* from the reports to follow. ;
* ---------------------------------------------------------------------------- ;
* assign library;
libname febstat 'S:FEBSTATDatasets';
* ---------------------------------------------------------------------------- ;
* set global macro variables including where to write your output file. ;
* ---------------------------------------------------------------------------- ;
%let lib=FEBSTAT; %put lib=&lib.;
%let masterFile=T1H01; %put masterFile=&masterFile.;
%let deceasedSrcFile=TRG03; %put deceasedSrcFile=&deceasedSrcFile.;
%let pdfDest=S:FEBSTATprogramst1hreportssubjectsMissingBaselineForms.pdf;
* ---------------------------------------------------------------------------- ;
* check to see when the dataset containing information on deceased subjects ;
* was created (from a database pull) ;
* ---------------------------------------------------------------------------- ;
PROC SQL noprint;
select datepart(crdate) format=mmddyy10. into:createDate
from dictionary.tables
where libname="&lib." and memname="&deceasedSrcFile";
QUIT;
%put createDate=&createDate.;
* ---------------------------------------------------------------------------- ;
* set options including macro and format locations ;
* ---------------------------------------------------------------------------- ;
options nocenter nonumber nodate;
options mautosource sasautos='S:FEBSTATprogramsmacros';
options symbolgen mprint;
options fmtsearch=(febstat);
* ---------------------------------------------------------------------------- ;
* Flag deceased subjects ;
* ---------------------------------------------------------------------------- ;
data passed;
set &lib..&deceasedSrcFile. (keep=iecnum idnum death
rename=(death=subjectDeceased));
if subjectDeceased=1;
run;
proc sort data=&lib..&masterFile. out=masterFile;
by idnum;
run;
data masterFile; set &lib..&masterfile.(keep=iecnum idnum);
in&masterFile.=1;
run;
%macro merge(dset);
proc format;
value yes
1='Yes'
.='No';
run;
proc sort data=&lib..&dset.;
by idnum;
run;
data &dset.; set &lib..&dset (keep=iecnum idnum);
in&dset.=1;
run;
data &dset.; merge masterFile(in=a) &dset(in=b) passed (in=c);
by idnum;
if a=1 and b^=1 and c^=1;
format in&dset. &dset. subjectDeceased yes.;
run;
*ods listing close;
ODS ESCAPECHAR='^';
ods proclabel="Missing &dset.";
ods pdf body="&pdfDest."
style = sasweb
startpage=yes;
footnote justify=right 'Page ^{thispage} of ^{lastpage}';
proc print data=&dset.;
var iecnum idnum in&masterFile. in&dset. subjectDeceased ;
title Subject Present in &masterFile. but not &dset.;
title2 As of &createDate..;
run;
%mend merge;
* ---------------------------------------------------------------------------- ;
* check for subjects missing from the following datasets ;
* ---------------------------------------------------------------------------- ;
%merge(T1H02)
%merge(T1H03)
%merge(T1H04)
%merge(T1H050)
%merge(T1H051)
%merge(T1H052)
%merge(T1H053)
%merge(T1H054)
%merge(T1H055)
%merge(T1H056)
%merge(T1H057)
%merge(T1H058)
%merge(T1H059a)
%merge(T1H059b)
%merge(T1H06)
%merge(T1H07)
ods pdf close;
ods listing;
* ---------------------------------------------------------------------------- ;
* Clear results window and delete all datasets from the work library ;
* (Optional and not necessary when running in batch mode) ;
* ---------------------------------------------------------------------------- ;
dm 'odsresults; clear';;
proc datasets library=work kill;
quit;
Recent Comments