caption = %bquote(Top &topnhdps. Codes Ranked by &rank. Selected by the High Dimensional Propensity Score Algorithm for &grouplabel. in the &database. from &startdateformatted. to &&enddate&periodid.formatted., by Data Partner (DP)&titlesuffix.),
****************************************************************************************************
****************************************************************************************************
* PROGRAM: appendix_driver.sas
* Created (mm/dd/yyyy): 02/25/2021
*--------------------------------------------------------------------------------------------------
* PURPOSE: This macro drives the creation of the report appendices
* -Excel file(s) containing code lists
* -tableofcontents: dataset containing table of contents
* -appendixreport: dataset containing appendix information for appendix_output.sas
* -datasets containing data to be output in appendix_output.sas
*--------------------------------------------------------------------------------------------------
* Sentinel Coordinating Center
* info@sentinelsystem.org
***************************************************************************************************;
%macro appendix_driver();
%put =====> MACRO CALLED: appendix_driver;
/*********************************************************************************************/
/* Utility macro to get check if a tab exists on an excel codelist file */
/*********************************************************************************************/
%macro xlsx_exist(libname,memname);
%let dsid = %sysfunc(open(sashelp.vmember(where=(libname=%upcase("&libname") and memname=%upcase("&memname")))));
%let ret=%eval(0=%sysfunc(fetch(&dsid)));
%let dsid=%sysfunc(close(&dsid));
%let tablecount = 2; /* Appendix A is tablecount 1 */
/*********************************************************************************************/
/* Create HDPS Var Info appendices */
/*********************************************************************************************/
/* Create appendix for each unique runid periodid combination */
%isdata(dataset=agghdps);
%if &nobs > 0 and &numl2comparisons > 0 %then %do;
proc sort nodupkey data = agghdps;
by dpidsiteid psestimategrp analysisgrp subgroup subgroupcat periodid descending ranking frequency codecat codetype code;