****************************************************************************************************
* PROGRAM OVERVIEW
****************************************************************************************************
*
* PROGRAM: create_tableofcontents.sas
* Created (mm/dd/yyyy): 02/09/2021
*
*--------------------------------------------------------------------------------------------------
* PURPOSE: This macro createas a dataset with 1 row per table and figure that is used as the
* report table of contents
*
* Program inputs:
*
* Program outputs:
* -tableofcontents: dataset containing table of contents
*
* PARAMETERS:
*
* Programming Notes:
*
*
*--------------------------------------------------------------------------------------------------
* CONTACT INFO:
* Sentinel Coordinating Center
* info@sentinelsystem.org
*
***************************************************************************************************;
%macro create_tableofcontents();
%put =====> MACRO CALLED: create_tableofcontents;
/*********************************************************************************************/
/* Utility macro to add row to tableofcontents file */
/*********************************************************************************************/
%macro addtotoc(tabnum=, caption=, appendixtype=);
data tableofcontents;
set tableofcontents end=eof;
output;
if eof then do;
tabnum = "&tabnum.";
caption = "&caption.";
appendixtype = "&appendixtype.";
output;
end;
run;
%mend;
/*********************************************************************************************/
/* Initialize empty table and table number */
/*********************************************************************************************/
data tableofcontents;
length tabnum $25 caption $500 appendixtype $30;
call missing(tabnum, caption, appendixtype);
run;
%let number = 1;
%let tablenum = 1;
/*********************************************************************************************/
/* Build table of contents */
/*********************************************************************************************/
/*********************************************************************************************/
/* Glossary rows */
/*********************************************************************************************/
%addtotoc(tabnum=Glossary (CIDA), caption=List of Terms to Define Cohort Identification and Descriptive Analysis (CIDA) Found in this Report);
%if %str("&reporttype") = %str("T2L2") | %str("&reporttype") = %str("T4L2") %then %do;
%addtotoc(tabnum=Glossary (PSA), caption=List of Terms to Define Propensity Score Analysis (PSA) Found in this Report);
%end;
/*********************************************************************************************/
/* Baseline Table */
/*********************************************************************************************/
%if %eval(&numbaselinetablegrp.>0) %then %do;
/*counter for determining table letter*/
%let tablecount = 1;
/* counter for determining table number */
%let tablenum = 2;
/*loop through each baseline table*/
%do b = 1 %to &numbaselinetablegrp.;
%let analysisgrp = ;
%let analysisgrp2 = ;
%let baselinegroupnum = ;
%let pregnancylabel = ;
%let includenonpregnant = N;