****************************************************************************************************
****************************************************************************************************
* 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);
%if &outputviewsdata = Y and %sysfunc(prxmatch(m/T1|T2L1/i,&reporttype)) %then %do;
%macro addtotoc_views(table=, dp=, runid=, periodid=, group=);
data tableofcontents_views;
set tableofcontents_views end=eof;
data tableofcontents_views;
length table $25 dp $10 runid $3 periodid 3 group $40;
call missing(table, dp, runid, periodid, group);
/*********************************************************************************************/
/* 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);