****************************************************************************************************
****************************************************************************************************
* 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
* -tableofcontents: dataset containing table of contents
*--------------------------------------------------------------------------------------------------
* 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=);
set tableofcontents end=eof;
appendixtype = "&appendixtype.";
/*********************************************************************************************/
/* Initialize empty table and table number */
/*********************************************************************************************/
length tabnum $25 caption $500 appendixtype $30;
call missing(tabnum, caption, appendixtype);
/*********************************************************************************************/
/* Build table of contents */
/*********************************************************************************************/
/*********************************************************************************************/
/*********************************************************************************************/
%addtotoc(tabnum=Glossary (CIDA), caption=List of Terms to Define the 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 the Propensity Score Analysis (PSA) Found in this Report);
/*********************************************************************************************/
/*********************************************************************************************/
%if %eval(&numbaselinetablegrp.>0) %then %do;
/*counter for determining table letter*/
/* counter for determining table number */
/*loop through each baseline table*/
%do b = 1 %to &numbaselinetablegrp.;
%let baselinegroupnum = ;