****************************************************************************************************
****************************************************************************************************
* 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);
- footnote table for dose generated in tables footnotes generated in t5tables_createdata */
set %if %sysfunc(prxmatch(m/T18_|T19_|T20_|T21_|T22_/i,&dataset.)) > 0 %then %do;
%substr(&dataset.,1,3)_lookup_footnotes_dose(where=(order not in (0
%if &collapse_vars. ne race | %index(&tablesub., race)=0 %then %do;
lookup.lookup_footnotes(where=(type = "t5tablefig" and order in (0
%if &collapse_vars. = race & %index(&tablesub., race)>0 %then %do;
select count(order) into: num_fn trimmed
%if &num_fn > 0 %then %do;
select description into: fn1 - :fn&num_fn.