I work for the DC DOH, and I'm trying to create a do file to create tables to display healthcare-associated infections data. The Council for State and Territorial Epidemiologists (CSTE) has provided a suggested standardized reporting template, and provided SAS code to generate the tables (SAS code and example output table attached). I've been trying to translate this SAS code to STATA , but am stumped on how best to export these data into a similar table format. Should I use putexcel? Or create a matrix? The variables are string, and no tabulations or summary statistics are needed, but automating the creation of these tables would definitely save time.
************************************************** ************************************************** ***********
Data Analysis and Presentation Standardization Toolkit: Generating a Facility-specific SIR Summary Table
The code below creates the SIR Summary table, using the conventions shown in the toolkit.
Developed by:
Ashley Fell, MPH
HAI Epidemiologist
TN Dept of Health
August 2015
************************************************** ************************************************** ***********;
/*Read in sample CLABSI data*/
data report_CLABSI;
**Variable formatting: edit as needed (e.g., facility name may require > 22 characters);
format ddays comma5. exp 4.2 sig 1.;
input FacName & $22. Unit & $24. ddays obs exp SIR & :$4. SIRL & :$4. SIRU & :$4. sig;
datalines;
Clean Memorial Adult and Pediatric ICUs 1523 1 2.80 0.36 0.21 0.58 3
Clean Memorial Neonatal ICUs (NICUs) 803 0 1.80 0.00 . 0.87 3
Clean Memorial Wards 986 3 4.11 0.73 0.71 1.02 1
Town Surgical Hospital Adult and Pediatric ICUs 251 0 0.64 N/A N/A N/A 4
Vine Medical Center Adult and Pediatric ICUs 2961 3 3.21 0.93 0.76 1.98 1
Vine Medical Center Wards 1002 2 2.84 0.70 0.64 0.93 3
;
run;
data report_CLABSI; format CI $12. SIR_int $24.; set report_CLABSI;
if SIR='N/A' then CI='N/A';
else if SIR ne 'N/A' then CI='('||SIRL||', '||SIRU||')';
**Add SIR interpretation text which will appear next to the symbol;
if sig=1 then SIR_int="= Same";
else if sig=2 then SIR_int="#{unicode 2715} Worse"; /*Use unicode to create the symbols*/
else if sig=3 then SIR_int="#{unicode 2605} Better"; /*Use unicode to create the symbols*/
else if sig=4 then SIR_int="No Conclusion";
**Make exp a text variable and add "Less than 1.0" when predicted infections <1;
exp_temp=put(exp,3.1);
if exp<1.0 then exp1="Less than 1.0";
else if exp>=1.0 then exp1=input(exp_temp,$3.);
run;
/*Read in sample CAUTI data*/
data report_CAUTI;
**Variable formatting: edit as needed (e.g., facility name may require > 22 characters);
format ddays comma5. exp 4.2 sig 1.;
input FacName & $22. Unit & $24. ddays obs exp SIR & :$4. SIRL & :$4. SIRU & :$4. sig;
datalines;
Clean Memorial Adult and Pediatric ICUs 6798 6 4.33 1.39 1.31 1.97 2
Town Surgical Hospital Adult and Pediatric ICUs 598 3 2.10 1.43 0.89 2.89 1
Vine Medical Center Adult and Pediatric ICUs 5139 5 3.98 1.26 0.87 1.35 1
;
run;
data report_CAUTI; format CI $12. SIR_int $24.; set report_CAUTI;
if SIR='N/A' then CI='N/A';
else if SIR ne 'N/A' then CI='('||SIRL||', '||SIRU||')';
**Add SIR interpretation text which will appear next to the symbol;
if sig=1 then SIR_int="= Same";
else if sig=2 then SIR_int="#{unicode 2715} Worse"; /*Use unicode to create the symbols*/
else if sig=3 then SIR_int="#{unicode 2605} Better"; /*Use unicode to create the symbols*/
else if sig=4 then SIR_int="No Conclusion";
**Make exp a text variable and add "Less than 1.0" when predicted infections <1;
exp_temp=put(exp,3.1);
if exp<1.0 then exp1="Less than 1.0";
else if exp>=1.0 then exp1=input(exp_temp,$3.);
run;
/*Read in sample SSI COLO data*/
data report_COLO;
**Variable formatting: edit as needed (e.g., facility name may require > 22 characters);
format ddays comma5. exp 4.2 sig 1.;
input FacName & $22. Unit & $22. ddays obs exp SIR & :$4. SIRL & :$4. SIRU & :$4. sig;
datalines;
Clean Memorial Colon Surgery 54 0 1.70 0.00 . 1.45 1
Town Surgical Hospital Colon Surgery 265 2 2.70 0.74 0.51 0.82 3
Vine Medical Center Colon Surgery 161 4 3.60 1.11 0.73 1.27 1
;
run;
data report_COLO; format CI $12. SIR_int $24.; set report_COLO;
if SIR='N/A' then CI='N/A';
else if SIR ne 'N/A' then CI='('||SIRL||', '||SIRU||')';
**Add SIR interpretation text which will appear next to the symbol;
if sig=1 then SIR_int="= Same";
else if sig=2 then SIR_int="#{unicode 2715} Worse"; /*Use unicode to create the symbols*/
else if sig=3 then SIR_int="#{unicode 2605} Better"; /*Use unicode to create the symbols*/
else if sig=4 then SIR_int="No Conclusion";
**Make exp a text variable and add "Less than 1.0" when predicted infections <1;
exp_temp=put(exp,3.1);
if exp<1.0 then exp1="Less than 1.0";
else if exp>=1.0 then exp1=input(exp_temp,$3.);
run;
/*Read in sample SSI HYST data*/
data report_HYST;
**Variable formatting: edit as needed (e.g., facility name may require > 22 characters);
format ddays comma5. exp 4.2 sig 1.;
input FacName & $22. Unit & $22. ddays obs exp SIR & :$4. SIRL & :$4. SIRU & :$4. sig;
datalines;
Clean Memorial Abdominal Hysterectomy 78 5 3.00 1.67 1.44 3.98 2
Town Surgical Hospital Abdominal Hysterectomy 200 5 6.80 0.74 0.62 1.04 1
Vine Medical Center Abdominal Hysterectomy 107 6 5.61 1.07 0.63 1.47 1
;
run;
data report_HYST; format CI $12. SIR_int $24.; set report_HYST;
if SIR='N/A' then CI='N/A';
else if SIR ne 'N/A' then CI='('||SIRL||', '||SIRU||')';
**Add SIR interpretation text which will appear next to the symbol;
if sig=1 then SIR_int="= Same";
else if sig=2 then SIR_int="#{unicode 2715} Worse"; /*Use unicode to create the symbols*/
else if sig=3 then SIR_int="#{unicode 2605} Better"; /*Use unicode to create the symbols*/
else if sig=4 then SIR_int="No Conclusion";
**Make exp a text variable and add "Less than 1.0" when predicted infections <1;
exp_temp=put(exp,3.1);
if exp<1.0 then exp1="Less than 1.0";
else if exp>=1.0 then exp1=input(exp_temp,$3.);
run;
/*Read in sample CDI LabID data*/
data report_CDI;
**Variable formatting: edit as needed (e.g., facility name may require > 22 characters);
format ddays comma5. exp 4.2 sig 1.;
input FacName & $22. Unit & $12. ddays obs exp SIR & :$4. SIRL & :$4. SIRU & :$4. sig;
datalines;
Clean Memorial CDI 6700 3 6.52 0.46 0.41 0.97 3
Town Surgical Hospital CDI 1202 5 4.09 1.22 0.93 1.49 1
Vine Medical Center CDI 10209 7 5.11 1.37 1.02 1.59 2
;
run;
data report_CDI; format CI $12. SIR_int $24.; set report_CDI;
if SIR='N/A' then CI='N/A';
else if SIR ne 'N/A' then CI='('||SIRL||', '||SIRU||')';
**Add SIR interpretation text which will appear next to the symbol;
if sig=1 then SIR_int="= Same";
else if sig=2 then SIR_int="#{unicode 2715} Worse"; /*Use unicode to create the symbols*/
else if sig=3 then SIR_int="#{unicode 2605} Better"; /*Use unicode to create the symbols*/
else if sig=4 then SIR_int="No Conclusion";
**Make exp a text variable and add "Less than 1.0" when predicted infections <1;
exp_temp=put(exp,3.1);
if exp<1.0 then exp1="Less than 1.0";
else if exp>=1.0 then exp1=input(exp_temp,$3.);
run;
/*Read in sample MRSA LabID data*/
data report_MRSA;
**Variable formatting: edit as needed (e.g., facility name may require > 22 characters);
format ddays comma5. exp 4.2 sig 1.;
input FacName & $22. Unit & $12. ddays obs exp SIR & :$4. SIRL & :$4. SIRU & :$4. sig;
datalines;
Clean Memorial MRSA 6798 4 6.52 0.61 0.41 0.97 3
Town Surgical Hospital MRSA 1202 1 0.98 N/A N/A N/A 4
Vine Medical Center MRSA 10802 6 3.03 1.98 1.24 2.01 2
;
run;
data report_MRSA; format CI $12. SIR_int $24.; set report_MRSA;
if SIR='N/A' then CI='N/A';
else if SIR ne 'N/A' then CI='('||SIRL||', '||SIRU||')';
**Add SIR interpretation text which will appear next to the symbol;
if sig=1 then SIR_int="= Same";
else if sig=2 then SIR_int="#{unicode 2715} Worse"; /*Use unicode to create the symbols*/
else if sig=3 then SIR_int="#{unicode 2605} Better"; /*Use unicode to create the symbols*/
else if sig=4 then SIR_int="No Conclusion";
**Make exp a text variable and add "Less than 1.0" when predicted infections <1;
exp_temp=put(exp,3.1);
if exp<1.0 then exp1="Less than 1.0";
else if exp>=1.0 then exp1=input(exp_temp,$3.);
run;
/************************************************** **********************************************
* Combine the different infecion types into one data set *
************************************************** **********************************************/
proc sort data=report_CLABSI; by facname; run;
proc sort data=report_CAUTI; by facname; run;
proc sort data=report_COLO; by facname; run;
proc sort data=report_HYST; by facname; run;
proc sort data=report_CDI; by facname; run;
proc sort data=report_MRSA; by facname; run;
data report_CLABSI_a;
set report_CLABSI;
where unit="Adult and Pediatric ICUs";
run;
data report_CAUTI_a;
set report_CAUTI;
where unit="Adult and Pediatric ICUs";
run;
data report_summary; format SIR_int_clab SIR_int_cau SIR_int_colo SIR_int_hyst SIR_int_cdi SIR_int_mrsa $24.;
merge report_CLABSI_a (keep=FacName sig rename=sig=sig_clab)
report_CAUTI_a (keep=FacName sig rename=sig=sig_cau)
report_COLO (keep=FacName sig rename=sig=sig_colo)
report_HYST (keep=FacName sig rename=sig=sig_hyst)
report_CDI (keep=FacName sig rename=sig=sig_cdi)
report_MRSA (keep=FacName sig rename=sig=sig_mrsa);
by facname;
**Add SIR interpretation symbol;
if sig_clab=1 then SIR_int_clab="=";
else if sig_clab=2 then SIR_int_clab="#{unicode 2715}"; /*Use unicode to create the symbols*/
else if sig_clab=3 then SIR_int_clab="#{unicode 2605}"; /*Use unicode to create the symbols*/
else if sig_clab=4 then SIR_int_clab="No Conclusion";
if sig_cau=1 then SIR_int_cau="=";
else if sig_cau=2 then SIR_int_cau="#{unicode 2715}"; /*Use unicode to create the symbols*/
else if sig_cau=3 then SIR_int_cau="#{unicode 2605}"; /*Use unicode to create the symbols*/
else if sig_cau=4 then SIR_int_cau="No Conclusion";
if sig_colo=1 then SIR_int_colo="=";
else if sig_colo=2 then SIR_int_colo="#{unicode 2715}"; /*Use unicode to create the symbols*/
else if sig_colo=3 then SIR_int_colo="#{unicode 2605}"; /*Use unicode to create the symbols*/
else if sig_colo=4 then SIR_int_colo="No Conclusion";
if sig_hyst=1 then SIR_int_hyst="=";
else if sig_hyst=2 then SIR_int_hyst="#{unicode 2715}"; /*Use unicode to create the symbols*/
else if sig_hyst=3 then SIR_int_hyst="#{unicode 2605}"; /*Use unicode to create the symbols*/
else if sig_hyst=4 then SIR_int_hyst="No Conclusion";
if sig_cdi=1 then SIR_int_cdi="=";
else if sig_cdi=2 then SIR_int_cdi="#{unicode 2715}"; /*Use unicode to create the symbols*/
else if sig_cdi=3 then SIR_int_cdi="#{unicode 2605}"; /*Use unicode to create the symbols*/
else if sig_cdi=4 then SIR_int_cdi="No Conclusion";
if sig_mrsa=1 then SIR_int_mrsa="=";
else if sig_mrsa=2 then SIR_int_mrsa="#{unicode 2715}"; /*Use unicode to create the symbols*/
else if sig_mrsa=3 then SIR_int_mrsa="#{unicode 2605}"; /*Use unicode to create the symbols*/
else if sig_mrsa=4 then SIR_int_mrsa="No Conclusion";
run;
/************************************************** **********************************************
* *
* Summary Table *
* *
************************************************** **********************************************/
ods escapechar="#";
data legend;
input better & $200. same & $200. worse & $200. nocon & $200.;
datalines;
Fewer infections (#S={font_weight=bold}better#S={font_weight=medium }) than predicted based on the national experience.* About the #S={font_weight=bold}same#S={font_weight=medium} number of infections as predicted based on the national experience.* More infections (#S={font_weight=bold}worse#S={font_weight=medium} ) than predicted based on the national experience.* When the number of predicted infections is less than 1, no conclusion can be made.
;
run;
data legend; set legend;
bettersym="#{unicode 2605}";
samesym="=";
worsesym="#{unicode 2715}";
noconsym="No Conclusion";
run;
/*Create the legend as a macro so we can easily add it to each page*/
%MACRO LEGEND;
**Legend**;
title;
proc report data=legend spanrows missing nowd headskip headline split='\'
/*Set the color/text style elements for the table*/
style(header)={ background=lightgrey foreground=black font_face=georgia font_weight=bold font_size=11pt}
style(column)={ background=white foreground=black bordertopcolor=black font_face=georgia font_size=10pt};
/*Identify the variables that will appear/are referenced in the table, and create any headers that span more than one variable*/
column ("Legend" bettersym better samesym same worsesym worse noconsym nocon);
/*Create header labels for each variable, set column widths and alignment*/
define bettersym / display center "" style(column)=[width=.38in vjust=middle];
define better / display "" style(column)=[width=1.76in vjust=middle] ;
define samesym / display center "" style(column)=[width=.38in vjust=middle];
define same / display "" style(column)=[width=1.76in vjust=middle] ;
define worsesym / display center "" style(column)=[width=.38in vjust=middle];
define worse / display "" style(column)=[width=1.76in vjust=middle] ;
define noconsym / display center "" style(column)=[width=1in vjust=middle];
define nocon / display "" style(column)=[width=1.9in vjust=middle] ;
/*Use the appropriate font/color for symbols*/
compute bettersym;
call define(_col_,"style", "style=[font_size=16pt fontweight=bold color=green borderrightcolor=white]");
endcomp;
compute samesym;
call define(_col_,"style", "style=[font_size=30pt fontweight=bold color=gray borderrightcolor=white]");
endcomp;
compute worsesym;
call define(_col_,"style", "style=[font_size=20pt fontweight=bold color=red borderrightcolor=white]");
endcomp;
compute noconsym;
call define(_col_,"style", "style=[font_size=11pt fontweight=bold color=black borderrightcolor=white]");
endcomp;
/*Footnote with baseline years*/
compute after /style=[font_size=9pt font_style=italic color=black fontfamily='georgia'];
line "*National experience contains data from 2006 – 2008 for CLABSI and SSI, 2009 for CAUTI, and 2010-2011 for MRSA and C. difficile Laboratory-Identified Events.";
endcomp;
run;
%MEND LEGEND;
/*Create a RTF document to output the tables (can be opened in MS Word)*/
title1; title2;
options nodate nonumber PAPERSIZE= STANDARD ORIENTATION = LANDSCAPE
topmargin=".75in" leftmargin=".75in" rightmargin=".75in" bottommargin=".75in";
%let filename="C:\Users\dc49c16\Desktop\Figures\DAPS_SI R Summary Table.RTF";
ods rtf file=&filename startpage=never /*bodytitle*/;
/*Print the legend*/
%LEGEND;
/*Title for the Summary table*/
ods rtf text="#S={font_size=11pt font_face='georgia' font_weight=bold just=l}[STATE] Infections Compared to the National Experience, Acute Care Hospital Report, [TIME PERIOD]";
**Summary Table**;
proc report data=report_summary spanrows missing nowd headskip headline split='\'
/*Set the color/text style elements for the table*/
style(header)={ background=lightgrey foreground=black font_face=georgia font_weight=bold font_size=11pt}
style(column)={ background=white foreground=black bordertopcolor=black font_face=georgia font_size=11pt};
/*Identify the variables that will appear/are referenced in the table, and create any headers that span more than one variable*/
column FacName SIR_int_clab SIR_int_cau SIR_int_colo SIR_int_hyst SIR_int_cdi SIR_int_mrsa
sig_clab sig_cau sig_colo sig_hyst sig_cdi sig_mrsa;
/*Create header labels for each variable, set column widths and alignment*/
define FacName / order center "Facility Name" style(column)=[width=1.75in vjust=middle];
define SIR_int_clab / display center "Bloodstream Infections (CLABSI)**" style(column)=[width=1.15in vjust=middle] ;
define SIR_int_cau / display center "Urinary Tract Infections (CAUTI)**" style(column)=[width=1.0in vjust=middle] ;
define SIR_int_colo / display center "Surgical Site Infections from Colon Surgeries" style(column)=[width=1.15in vjust=middle] ;
define SIR_int_hyst / display center "Surgical Site Infections from Abdominal Hysterectomies" style(column)=[width=1.4in vjust=middle] ;
define SIR_int_cdi / display center "#S={font_style=italic}C. difficile #S={font_style=roman}Events#{unicode 2020}" style(column)=[width=1.0in vjust=middle] ;
define SIR_int_mrsa / display center "Methicillin-Resistant #S={font_style=italic}Staphylococcus aureus#S={font_style=roman} (MRSA) Events#{unicode 2020}" style(column)=[width=1.75in vjust=middle] ;
define sig_clab / display noprint;
define sig_cau / display noprint;
define sig_colo / display noprint;
define sig_hyst / display noprint;
define sig_cdi / display noprint;
define sig_mrsa / display noprint;
/*Use the appropriate font/color for SIR interpretation*/
compute sig_clab;
if sig_clab=1
then call define('SIR_int_clab',"style", "style=[font_size=26pt fontweight=bold color=gray]");
else if sig_clab=2
then call define('SIR_int_clab',"style", "style=[font_size=16pt fontweight=bold color=red]");
else if sig_clab=3
then call define('SIR_int_clab',"style", "style=[font_size=16pt fontweight=bold color=green]");
else if sig_clab=4
then call define('SIR_int_clab',"style", "style=[font_size=12pt fontweight=bold color=black]");
endcomp;
compute sig_cau;
if sig_cau="1"
then call define('SIR_int_cau',"style", "style=[font_size=26pt fontweight=bold color=gray]");
else if sig_cau="2"
then call define('SIR_int_cau',"style", "style=[font_size=16pt fontweight=bold color=red]");
else if sig_cau="3"
then call define('SIR_int_cau',"style", "style=[font_size=16pt fontweight=bold color=green]");
else if sig_cau="4"
then call define('SIR_int_cau',"style", "style=[font_size=12pt fontweight=bold color=black]");
endcomp;
compute sig_colo;
if sig_colo="1"
then call define('SIR_int_colo',"style", "style=[font_size=26pt fontweight=bold color=gray]");
else if sig_colo="2"
then call define('SIR_int_colo',"style", "style=[font_size=16pt fontweight=bold color=red]");
else if sig_colo="3"
then call define('SIR_int_colo',"style", "style=[font_size=16pt fontweight=bold color=green]");
else if sig_colo="4"
then call define('SIR_int_colo',"style", "style=[font_size=12pt fontweight=bold color=black]");
endcomp;
compute sig_hyst;
if sig_hyst="1"
then call define('SIR_int_hyst',"style", "style=[font_size=26pt fontweight=bold color=gray]");
else if sig_hyst="2"
then call define('SIR_int_hyst',"style", "style=[font_size=16pt fontweight=bold color=red]");
else if sig_hyst="3"
then call define('SIR_int_hyst',"style", "style=[font_size=16pt fontweight=bold color=green]");
else if sig_hyst="4"
then call define('SIR_int_hyst',"style", "style=[font_size=12pt fontweight=bold color=black]");
endcomp;
compute sig_cdi;
if sig_cdi="1"
then call define('SIR_int_cdi',"style", "style=[font_size=26pt fontweight=bold color=gray]");
else if sig_cdi="2"
then call define('SIR_int_cdi',"style", "style=[font_size=16pt fontweight=bold color=red]");
else if sig_cdi="3"
then call define('SIR_int_cdi',"style", "style=[font_size=16pt fontweight=bold color=green]");
else if sig_cdi="4"
then call define('SIR_int_cdi',"style", "style=[font_size=12pt fontweight=bold color=black]");
endcomp;
compute sig_mrsa;
if sig_mrsa="1"
then call define('SIR_int_mrsa',"style", "style=[font_size=26pt fontweight=bold color=gray]");
else if sig_mrsa="2"
then call define('SIR_int_mrsa',"style", "style=[font_size=16pt fontweight=bold color=red]");
else if sig_mrsa="3"
then call define('SIR_int_mrsa',"style", "style=[font_size=16pt fontweight=bold color=green]");
else if sig_mrsa="4"
then call define('SIR_int_mrsa',"style", "style=[font_size=12pt fontweight=bold color=black]");
endcomp;
/*Footnote*/
compute after /style=[font_size=10pt font_style=italic color=black fontfamily='georgia' just=l];
line "**CLABSI and CAUTI data include only adult and pediatric intensive care units (ICUs); data from neonatal ICUs (NICUs) and ward locations can be found in HAI-specific data tables.";
line "#{unicode 2020} These refer to hospital-onset laboratory-identified events. MRSA events include only those identified in the bloodstream.";
endcomp;
run;
ods rtf close;
************************************************** ************************************************** ***********
Data Analysis and Presentation Standardization Toolkit: Generating a Facility-specific SIR Summary Table
The code below creates the SIR Summary table, using the conventions shown in the toolkit.
Developed by:
Ashley Fell, MPH
HAI Epidemiologist
TN Dept of Health
August 2015
************************************************** ************************************************** ***********;
/*Read in sample CLABSI data*/
data report_CLABSI;
**Variable formatting: edit as needed (e.g., facility name may require > 22 characters);
format ddays comma5. exp 4.2 sig 1.;
input FacName & $22. Unit & $24. ddays obs exp SIR & :$4. SIRL & :$4. SIRU & :$4. sig;
datalines;
Clean Memorial Adult and Pediatric ICUs 1523 1 2.80 0.36 0.21 0.58 3
Clean Memorial Neonatal ICUs (NICUs) 803 0 1.80 0.00 . 0.87 3
Clean Memorial Wards 986 3 4.11 0.73 0.71 1.02 1
Town Surgical Hospital Adult and Pediatric ICUs 251 0 0.64 N/A N/A N/A 4
Vine Medical Center Adult and Pediatric ICUs 2961 3 3.21 0.93 0.76 1.98 1
Vine Medical Center Wards 1002 2 2.84 0.70 0.64 0.93 3
;
run;
data report_CLABSI; format CI $12. SIR_int $24.; set report_CLABSI;
if SIR='N/A' then CI='N/A';
else if SIR ne 'N/A' then CI='('||SIRL||', '||SIRU||')';
**Add SIR interpretation text which will appear next to the symbol;
if sig=1 then SIR_int="= Same";
else if sig=2 then SIR_int="#{unicode 2715} Worse"; /*Use unicode to create the symbols*/
else if sig=3 then SIR_int="#{unicode 2605} Better"; /*Use unicode to create the symbols*/
else if sig=4 then SIR_int="No Conclusion";
**Make exp a text variable and add "Less than 1.0" when predicted infections <1;
exp_temp=put(exp,3.1);
if exp<1.0 then exp1="Less than 1.0";
else if exp>=1.0 then exp1=input(exp_temp,$3.);
run;
/*Read in sample CAUTI data*/
data report_CAUTI;
**Variable formatting: edit as needed (e.g., facility name may require > 22 characters);
format ddays comma5. exp 4.2 sig 1.;
input FacName & $22. Unit & $24. ddays obs exp SIR & :$4. SIRL & :$4. SIRU & :$4. sig;
datalines;
Clean Memorial Adult and Pediatric ICUs 6798 6 4.33 1.39 1.31 1.97 2
Town Surgical Hospital Adult and Pediatric ICUs 598 3 2.10 1.43 0.89 2.89 1
Vine Medical Center Adult and Pediatric ICUs 5139 5 3.98 1.26 0.87 1.35 1
;
run;
data report_CAUTI; format CI $12. SIR_int $24.; set report_CAUTI;
if SIR='N/A' then CI='N/A';
else if SIR ne 'N/A' then CI='('||SIRL||', '||SIRU||')';
**Add SIR interpretation text which will appear next to the symbol;
if sig=1 then SIR_int="= Same";
else if sig=2 then SIR_int="#{unicode 2715} Worse"; /*Use unicode to create the symbols*/
else if sig=3 then SIR_int="#{unicode 2605} Better"; /*Use unicode to create the symbols*/
else if sig=4 then SIR_int="No Conclusion";
**Make exp a text variable and add "Less than 1.0" when predicted infections <1;
exp_temp=put(exp,3.1);
if exp<1.0 then exp1="Less than 1.0";
else if exp>=1.0 then exp1=input(exp_temp,$3.);
run;
/*Read in sample SSI COLO data*/
data report_COLO;
**Variable formatting: edit as needed (e.g., facility name may require > 22 characters);
format ddays comma5. exp 4.2 sig 1.;
input FacName & $22. Unit & $22. ddays obs exp SIR & :$4. SIRL & :$4. SIRU & :$4. sig;
datalines;
Clean Memorial Colon Surgery 54 0 1.70 0.00 . 1.45 1
Town Surgical Hospital Colon Surgery 265 2 2.70 0.74 0.51 0.82 3
Vine Medical Center Colon Surgery 161 4 3.60 1.11 0.73 1.27 1
;
run;
data report_COLO; format CI $12. SIR_int $24.; set report_COLO;
if SIR='N/A' then CI='N/A';
else if SIR ne 'N/A' then CI='('||SIRL||', '||SIRU||')';
**Add SIR interpretation text which will appear next to the symbol;
if sig=1 then SIR_int="= Same";
else if sig=2 then SIR_int="#{unicode 2715} Worse"; /*Use unicode to create the symbols*/
else if sig=3 then SIR_int="#{unicode 2605} Better"; /*Use unicode to create the symbols*/
else if sig=4 then SIR_int="No Conclusion";
**Make exp a text variable and add "Less than 1.0" when predicted infections <1;
exp_temp=put(exp,3.1);
if exp<1.0 then exp1="Less than 1.0";
else if exp>=1.0 then exp1=input(exp_temp,$3.);
run;
/*Read in sample SSI HYST data*/
data report_HYST;
**Variable formatting: edit as needed (e.g., facility name may require > 22 characters);
format ddays comma5. exp 4.2 sig 1.;
input FacName & $22. Unit & $22. ddays obs exp SIR & :$4. SIRL & :$4. SIRU & :$4. sig;
datalines;
Clean Memorial Abdominal Hysterectomy 78 5 3.00 1.67 1.44 3.98 2
Town Surgical Hospital Abdominal Hysterectomy 200 5 6.80 0.74 0.62 1.04 1
Vine Medical Center Abdominal Hysterectomy 107 6 5.61 1.07 0.63 1.47 1
;
run;
data report_HYST; format CI $12. SIR_int $24.; set report_HYST;
if SIR='N/A' then CI='N/A';
else if SIR ne 'N/A' then CI='('||SIRL||', '||SIRU||')';
**Add SIR interpretation text which will appear next to the symbol;
if sig=1 then SIR_int="= Same";
else if sig=2 then SIR_int="#{unicode 2715} Worse"; /*Use unicode to create the symbols*/
else if sig=3 then SIR_int="#{unicode 2605} Better"; /*Use unicode to create the symbols*/
else if sig=4 then SIR_int="No Conclusion";
**Make exp a text variable and add "Less than 1.0" when predicted infections <1;
exp_temp=put(exp,3.1);
if exp<1.0 then exp1="Less than 1.0";
else if exp>=1.0 then exp1=input(exp_temp,$3.);
run;
/*Read in sample CDI LabID data*/
data report_CDI;
**Variable formatting: edit as needed (e.g., facility name may require > 22 characters);
format ddays comma5. exp 4.2 sig 1.;
input FacName & $22. Unit & $12. ddays obs exp SIR & :$4. SIRL & :$4. SIRU & :$4. sig;
datalines;
Clean Memorial CDI 6700 3 6.52 0.46 0.41 0.97 3
Town Surgical Hospital CDI 1202 5 4.09 1.22 0.93 1.49 1
Vine Medical Center CDI 10209 7 5.11 1.37 1.02 1.59 2
;
run;
data report_CDI; format CI $12. SIR_int $24.; set report_CDI;
if SIR='N/A' then CI='N/A';
else if SIR ne 'N/A' then CI='('||SIRL||', '||SIRU||')';
**Add SIR interpretation text which will appear next to the symbol;
if sig=1 then SIR_int="= Same";
else if sig=2 then SIR_int="#{unicode 2715} Worse"; /*Use unicode to create the symbols*/
else if sig=3 then SIR_int="#{unicode 2605} Better"; /*Use unicode to create the symbols*/
else if sig=4 then SIR_int="No Conclusion";
**Make exp a text variable and add "Less than 1.0" when predicted infections <1;
exp_temp=put(exp,3.1);
if exp<1.0 then exp1="Less than 1.0";
else if exp>=1.0 then exp1=input(exp_temp,$3.);
run;
/*Read in sample MRSA LabID data*/
data report_MRSA;
**Variable formatting: edit as needed (e.g., facility name may require > 22 characters);
format ddays comma5. exp 4.2 sig 1.;
input FacName & $22. Unit & $12. ddays obs exp SIR & :$4. SIRL & :$4. SIRU & :$4. sig;
datalines;
Clean Memorial MRSA 6798 4 6.52 0.61 0.41 0.97 3
Town Surgical Hospital MRSA 1202 1 0.98 N/A N/A N/A 4
Vine Medical Center MRSA 10802 6 3.03 1.98 1.24 2.01 2
;
run;
data report_MRSA; format CI $12. SIR_int $24.; set report_MRSA;
if SIR='N/A' then CI='N/A';
else if SIR ne 'N/A' then CI='('||SIRL||', '||SIRU||')';
**Add SIR interpretation text which will appear next to the symbol;
if sig=1 then SIR_int="= Same";
else if sig=2 then SIR_int="#{unicode 2715} Worse"; /*Use unicode to create the symbols*/
else if sig=3 then SIR_int="#{unicode 2605} Better"; /*Use unicode to create the symbols*/
else if sig=4 then SIR_int="No Conclusion";
**Make exp a text variable and add "Less than 1.0" when predicted infections <1;
exp_temp=put(exp,3.1);
if exp<1.0 then exp1="Less than 1.0";
else if exp>=1.0 then exp1=input(exp_temp,$3.);
run;
/************************************************** **********************************************
* Combine the different infecion types into one data set *
************************************************** **********************************************/
proc sort data=report_CLABSI; by facname; run;
proc sort data=report_CAUTI; by facname; run;
proc sort data=report_COLO; by facname; run;
proc sort data=report_HYST; by facname; run;
proc sort data=report_CDI; by facname; run;
proc sort data=report_MRSA; by facname; run;
data report_CLABSI_a;
set report_CLABSI;
where unit="Adult and Pediatric ICUs";
run;
data report_CAUTI_a;
set report_CAUTI;
where unit="Adult and Pediatric ICUs";
run;
data report_summary; format SIR_int_clab SIR_int_cau SIR_int_colo SIR_int_hyst SIR_int_cdi SIR_int_mrsa $24.;
merge report_CLABSI_a (keep=FacName sig rename=sig=sig_clab)
report_CAUTI_a (keep=FacName sig rename=sig=sig_cau)
report_COLO (keep=FacName sig rename=sig=sig_colo)
report_HYST (keep=FacName sig rename=sig=sig_hyst)
report_CDI (keep=FacName sig rename=sig=sig_cdi)
report_MRSA (keep=FacName sig rename=sig=sig_mrsa);
by facname;
**Add SIR interpretation symbol;
if sig_clab=1 then SIR_int_clab="=";
else if sig_clab=2 then SIR_int_clab="#{unicode 2715}"; /*Use unicode to create the symbols*/
else if sig_clab=3 then SIR_int_clab="#{unicode 2605}"; /*Use unicode to create the symbols*/
else if sig_clab=4 then SIR_int_clab="No Conclusion";
if sig_cau=1 then SIR_int_cau="=";
else if sig_cau=2 then SIR_int_cau="#{unicode 2715}"; /*Use unicode to create the symbols*/
else if sig_cau=3 then SIR_int_cau="#{unicode 2605}"; /*Use unicode to create the symbols*/
else if sig_cau=4 then SIR_int_cau="No Conclusion";
if sig_colo=1 then SIR_int_colo="=";
else if sig_colo=2 then SIR_int_colo="#{unicode 2715}"; /*Use unicode to create the symbols*/
else if sig_colo=3 then SIR_int_colo="#{unicode 2605}"; /*Use unicode to create the symbols*/
else if sig_colo=4 then SIR_int_colo="No Conclusion";
if sig_hyst=1 then SIR_int_hyst="=";
else if sig_hyst=2 then SIR_int_hyst="#{unicode 2715}"; /*Use unicode to create the symbols*/
else if sig_hyst=3 then SIR_int_hyst="#{unicode 2605}"; /*Use unicode to create the symbols*/
else if sig_hyst=4 then SIR_int_hyst="No Conclusion";
if sig_cdi=1 then SIR_int_cdi="=";
else if sig_cdi=2 then SIR_int_cdi="#{unicode 2715}"; /*Use unicode to create the symbols*/
else if sig_cdi=3 then SIR_int_cdi="#{unicode 2605}"; /*Use unicode to create the symbols*/
else if sig_cdi=4 then SIR_int_cdi="No Conclusion";
if sig_mrsa=1 then SIR_int_mrsa="=";
else if sig_mrsa=2 then SIR_int_mrsa="#{unicode 2715}"; /*Use unicode to create the symbols*/
else if sig_mrsa=3 then SIR_int_mrsa="#{unicode 2605}"; /*Use unicode to create the symbols*/
else if sig_mrsa=4 then SIR_int_mrsa="No Conclusion";
run;
/************************************************** **********************************************
* *
* Summary Table *
* *
************************************************** **********************************************/
ods escapechar="#";
data legend;
input better & $200. same & $200. worse & $200. nocon & $200.;
datalines;
Fewer infections (#S={font_weight=bold}better#S={font_weight=medium }) than predicted based on the national experience.* About the #S={font_weight=bold}same#S={font_weight=medium} number of infections as predicted based on the national experience.* More infections (#S={font_weight=bold}worse#S={font_weight=medium} ) than predicted based on the national experience.* When the number of predicted infections is less than 1, no conclusion can be made.
;
run;
data legend; set legend;
bettersym="#{unicode 2605}";
samesym="=";
worsesym="#{unicode 2715}";
noconsym="No Conclusion";
run;
/*Create the legend as a macro so we can easily add it to each page*/
%MACRO LEGEND;
**Legend**;
title;
proc report data=legend spanrows missing nowd headskip headline split='\'
/*Set the color/text style elements for the table*/
style(header)={ background=lightgrey foreground=black font_face=georgia font_weight=bold font_size=11pt}
style(column)={ background=white foreground=black bordertopcolor=black font_face=georgia font_size=10pt};
/*Identify the variables that will appear/are referenced in the table, and create any headers that span more than one variable*/
column ("Legend" bettersym better samesym same worsesym worse noconsym nocon);
/*Create header labels for each variable, set column widths and alignment*/
define bettersym / display center "" style(column)=[width=.38in vjust=middle];
define better / display "" style(column)=[width=1.76in vjust=middle] ;
define samesym / display center "" style(column)=[width=.38in vjust=middle];
define same / display "" style(column)=[width=1.76in vjust=middle] ;
define worsesym / display center "" style(column)=[width=.38in vjust=middle];
define worse / display "" style(column)=[width=1.76in vjust=middle] ;
define noconsym / display center "" style(column)=[width=1in vjust=middle];
define nocon / display "" style(column)=[width=1.9in vjust=middle] ;
/*Use the appropriate font/color for symbols*/
compute bettersym;
call define(_col_,"style", "style=[font_size=16pt fontweight=bold color=green borderrightcolor=white]");
endcomp;
compute samesym;
call define(_col_,"style", "style=[font_size=30pt fontweight=bold color=gray borderrightcolor=white]");
endcomp;
compute worsesym;
call define(_col_,"style", "style=[font_size=20pt fontweight=bold color=red borderrightcolor=white]");
endcomp;
compute noconsym;
call define(_col_,"style", "style=[font_size=11pt fontweight=bold color=black borderrightcolor=white]");
endcomp;
/*Footnote with baseline years*/
compute after /style=[font_size=9pt font_style=italic color=black fontfamily='georgia'];
line "*National experience contains data from 2006 – 2008 for CLABSI and SSI, 2009 for CAUTI, and 2010-2011 for MRSA and C. difficile Laboratory-Identified Events.";
endcomp;
run;
%MEND LEGEND;
/*Create a RTF document to output the tables (can be opened in MS Word)*/
title1; title2;
options nodate nonumber PAPERSIZE= STANDARD ORIENTATION = LANDSCAPE
topmargin=".75in" leftmargin=".75in" rightmargin=".75in" bottommargin=".75in";
%let filename="C:\Users\dc49c16\Desktop\Figures\DAPS_SI R Summary Table.RTF";
ods rtf file=&filename startpage=never /*bodytitle*/;
/*Print the legend*/
%LEGEND;
/*Title for the Summary table*/
ods rtf text="#S={font_size=11pt font_face='georgia' font_weight=bold just=l}[STATE] Infections Compared to the National Experience, Acute Care Hospital Report, [TIME PERIOD]";
**Summary Table**;
proc report data=report_summary spanrows missing nowd headskip headline split='\'
/*Set the color/text style elements for the table*/
style(header)={ background=lightgrey foreground=black font_face=georgia font_weight=bold font_size=11pt}
style(column)={ background=white foreground=black bordertopcolor=black font_face=georgia font_size=11pt};
/*Identify the variables that will appear/are referenced in the table, and create any headers that span more than one variable*/
column FacName SIR_int_clab SIR_int_cau SIR_int_colo SIR_int_hyst SIR_int_cdi SIR_int_mrsa
sig_clab sig_cau sig_colo sig_hyst sig_cdi sig_mrsa;
/*Create header labels for each variable, set column widths and alignment*/
define FacName / order center "Facility Name" style(column)=[width=1.75in vjust=middle];
define SIR_int_clab / display center "Bloodstream Infections (CLABSI)**" style(column)=[width=1.15in vjust=middle] ;
define SIR_int_cau / display center "Urinary Tract Infections (CAUTI)**" style(column)=[width=1.0in vjust=middle] ;
define SIR_int_colo / display center "Surgical Site Infections from Colon Surgeries" style(column)=[width=1.15in vjust=middle] ;
define SIR_int_hyst / display center "Surgical Site Infections from Abdominal Hysterectomies" style(column)=[width=1.4in vjust=middle] ;
define SIR_int_cdi / display center "#S={font_style=italic}C. difficile #S={font_style=roman}Events#{unicode 2020}" style(column)=[width=1.0in vjust=middle] ;
define SIR_int_mrsa / display center "Methicillin-Resistant #S={font_style=italic}Staphylococcus aureus#S={font_style=roman} (MRSA) Events#{unicode 2020}" style(column)=[width=1.75in vjust=middle] ;
define sig_clab / display noprint;
define sig_cau / display noprint;
define sig_colo / display noprint;
define sig_hyst / display noprint;
define sig_cdi / display noprint;
define sig_mrsa / display noprint;
/*Use the appropriate font/color for SIR interpretation*/
compute sig_clab;
if sig_clab=1
then call define('SIR_int_clab',"style", "style=[font_size=26pt fontweight=bold color=gray]");
else if sig_clab=2
then call define('SIR_int_clab',"style", "style=[font_size=16pt fontweight=bold color=red]");
else if sig_clab=3
then call define('SIR_int_clab',"style", "style=[font_size=16pt fontweight=bold color=green]");
else if sig_clab=4
then call define('SIR_int_clab',"style", "style=[font_size=12pt fontweight=bold color=black]");
endcomp;
compute sig_cau;
if sig_cau="1"
then call define('SIR_int_cau',"style", "style=[font_size=26pt fontweight=bold color=gray]");
else if sig_cau="2"
then call define('SIR_int_cau',"style", "style=[font_size=16pt fontweight=bold color=red]");
else if sig_cau="3"
then call define('SIR_int_cau',"style", "style=[font_size=16pt fontweight=bold color=green]");
else if sig_cau="4"
then call define('SIR_int_cau',"style", "style=[font_size=12pt fontweight=bold color=black]");
endcomp;
compute sig_colo;
if sig_colo="1"
then call define('SIR_int_colo',"style", "style=[font_size=26pt fontweight=bold color=gray]");
else if sig_colo="2"
then call define('SIR_int_colo',"style", "style=[font_size=16pt fontweight=bold color=red]");
else if sig_colo="3"
then call define('SIR_int_colo',"style", "style=[font_size=16pt fontweight=bold color=green]");
else if sig_colo="4"
then call define('SIR_int_colo',"style", "style=[font_size=12pt fontweight=bold color=black]");
endcomp;
compute sig_hyst;
if sig_hyst="1"
then call define('SIR_int_hyst',"style", "style=[font_size=26pt fontweight=bold color=gray]");
else if sig_hyst="2"
then call define('SIR_int_hyst',"style", "style=[font_size=16pt fontweight=bold color=red]");
else if sig_hyst="3"
then call define('SIR_int_hyst',"style", "style=[font_size=16pt fontweight=bold color=green]");
else if sig_hyst="4"
then call define('SIR_int_hyst',"style", "style=[font_size=12pt fontweight=bold color=black]");
endcomp;
compute sig_cdi;
if sig_cdi="1"
then call define('SIR_int_cdi',"style", "style=[font_size=26pt fontweight=bold color=gray]");
else if sig_cdi="2"
then call define('SIR_int_cdi',"style", "style=[font_size=16pt fontweight=bold color=red]");
else if sig_cdi="3"
then call define('SIR_int_cdi',"style", "style=[font_size=16pt fontweight=bold color=green]");
else if sig_cdi="4"
then call define('SIR_int_cdi',"style", "style=[font_size=12pt fontweight=bold color=black]");
endcomp;
compute sig_mrsa;
if sig_mrsa="1"
then call define('SIR_int_mrsa',"style", "style=[font_size=26pt fontweight=bold color=gray]");
else if sig_mrsa="2"
then call define('SIR_int_mrsa',"style", "style=[font_size=16pt fontweight=bold color=red]");
else if sig_mrsa="3"
then call define('SIR_int_mrsa',"style", "style=[font_size=16pt fontweight=bold color=green]");
else if sig_mrsa="4"
then call define('SIR_int_mrsa',"style", "style=[font_size=12pt fontweight=bold color=black]");
endcomp;
/*Footnote*/
compute after /style=[font_size=10pt font_style=italic color=black fontfamily='georgia' just=l];
line "**CLABSI and CAUTI data include only adult and pediatric intensive care units (ICUs); data from neonatal ICUs (NICUs) and ward locations can be found in HAI-specific data tables.";
line "#{unicode 2020} These refer to hospital-onset laboratory-identified events. MRSA events include only those identified in the bloodstream.";
endcomp;
run;
ods rtf close;
Comment