****************************************************************************************************
****************************************************************************************************
* PROGRAM: t1t2conc_output.sas
* Created (mm/dd/yyyy): 09/21/2021
*--------------------------------------------------------------------------------------------------
* PURPOSE: This macro drives the creation of T1/T2 and Concomitant Tables proc report output
* - final_[t1cida/t2cida/t2conc]
* - final_dps_[t1cida/t2cida/t2conc]
* - repdata.table&tablenum.&tableletter
* - dataset = Input dataset (aggregated t1cida/t2cida/t2conc dataset)
* - varlist = List of character columns to be printed
* - stratavar = Stratification variable
* - varwidth = Width of variable
* - varsmallcells = Determine small cell count highlighting
*--------------------------------------------------------------------------------------------------
* Sentinel Coordinating Center
* info@sentinelsystem.org
***************************************************************************************************;
%macro t1t2conc_output(dataset=,varlist=,stratavar=,varwidths=,varsmallcells=,title=);
%isdata(dataset=repdata.table&tablenum.&tableletter.);
%if %eval(&nobs.<1) %then %do;
data repdata.table&tablenum.&tableletter;
%if &includeheaderrow = Y %then %do;
if missing(header) then header=grouplabel;
%if %sysfunc(countw(&stratavar.)) >=2 %then %do;
%do cat = 1 %to %eval(%sysfunc(countw(&stratavar.))-1);
newcategory = strip(%scan(&stratavar., &cat.));;
newcategory = cat(strip(newcategory),", ", strip(%scan(&stratavar., &cat.)));;
%if %index(&stratavar,race) %then %do;
proc contents data = repdata.table&tablenum.&tableletter out=t noprint;