****************************************************************************************************
****************************************************************************************************
* PROGRAM: t5tables_output.sas
* Created (mm/dd/yyyy): 08/25/2021
*--------------------------------------------------------------------------------------------------
* PURPOSE: This macro includes two proc report procedures in order to produce a categorical and
* continuous table in the report for Type 5 analyses
* - Dataset(s) computed in %t5tables_createdata
* - Dataset(s) to output/repdata for each figure
* - dataset: input dataset
* - reporttype: indicator whether to produce categorical (cat) or continuous (dist) metrics
*--------------------------------------------------------------------------------------------------
* Sentinel Coordinating Center
* info@sentinelsystem.org
***************************************************************************************************;
%macro t5tables_output(dataset=, reporttype=);
%put =====> MACRO CALLED: t5tables_output;
select max(sortorder1), max(sortorder2)
into :maxorder1, :maxorder2
%put maxorder1 = &maxorder1.;
%put maxorder2 = &maxorder2.;
if "&dataset" = catx('_',table,put(stratificationorder,best.)) then do;
call symputx('tablesub', tablesub);
%if %sysfunc(prxmatch(m/T18_|T19_|T20_|T21_|T22_/i,&dataset.)) = 0 %then %do;
call symputx('categories', categories);
if tablesub = 'overall' and "&stratifybydp." = "Y" then call symputx('tabletitle', ', by Data Partner');
else call symputx('tabletitle', tabletitle);