values("South", "Delaware, District of Columbia, Florida, Georgia, Maryland, North Carolina, South Carolina, Virginia, West Virginia, Alabama, Kentucky, Mississippi, Tennessee, Arkansas, Louisiana, Oklahoma, Texas")
****************************************************************************************************
****************************************************************************************************
* 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 data = agghdps;
by dpidsiteid psestimategrp periodid descending ranking;
by dpidsiteid psestimategrp periodid descending ranking;
if first.periodid then hdpsnum = 1;
/* Loop through all order values */
%do corder = 1 %to &numl2comparisons;
set l2comparisonfile(where=(order=&corder.));
call symputx('runid', runid);
call symputx('psestimategrp', psestimategrp);
call symputx('unique_psestimate',unique_psestimate);
if missing(topnhdps) then call symputx('topnhdps',25);
else call symputx('topnhdps',topnhdps);
call symputx('analysisgrp', analysisgrp);
/*extract QRP input file associated with analysisgrp*/
select distinct strip(file) into: pscsfile trimmed