****************************************************************************************************
* PROGRAM OVERVIEW
****************************************************************************************************
*
* 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
*
* Program inputs:
* - Dataset(s) computed in %t5tables_createdata
*
* Program outputs:
* - Dataset(s) to output/repdata for each figure
*
* PARAMETERS:
* - dataset: input dataset
* - report: indicator whether to produce categorical (1) or continuous (2) metrics
*
*
* Programming Notes:
*
*
*--------------------------------------------------------------------------------------------------
* CONTACT INFO:
* Sentinel Coordinating Center
* info@sentinelsystem.org
*
***************************************************************************************************;
%macro t5tables_output(dataset=,
reporttype=);
%put =====> MACRO CALLED: t5tables_output;
%let header=;
%if &labelfileexists. = Y %then %do;
data headerlabelyes;
set labelfile(where=(labeltype='header'));
run;
%isdata(dataset=headerlabelyes);
data repdata.table&tablenum.&tableletter.;
set &dataset.;
%if %eval(&nobs.>0) %then %do;
if missing(header)=0 then call symputx('header','header');
%end;
run;
/*Clean up*/
proc datasets nowarn noprint lib=work;
delete headerlabelyes;
quit;
%end;
%else %do;
data repdata.table&tablenum.&tableletter.;
set &dataset.;
run;
%end;
proc sql noprint;
select max(sortorder1), max(sortorder2)
into :maxorder1, :maxorder2
from &dataset.;
quit;
%put maxorder1 = &maxorder1.;
%put maxorder2 = &maxorder2.;
%let num_fn = 0;
%let t5title = ;
%let tabletitle = ;
%let categories = ;
%let num_categories = ;
%if %sysfunc(prxmatch(m/T18_|T19_|T20_|T21_|T22_/i,&dataset.)) > 0 %then %do;
data _null_;
set MASTER_TYPEFILE;
%if %sysfunc(prxmatch(m/T18_/i,&dataset.)) > 0 %then %do;
call symputx('categories', cfdd_output_cat);
%end;
%if %sysfunc(prxmatch(m/T19_|T20_/i,&dataset.)) > 0 %then %do;
call symputx('categories', afdd_output_cat);
%end;
%if %sysfunc(prxmatch(m/T21_|T22_/i,&dataset.)) > 0 %then %do;
call symputx('categories', cumdose_output_cat);
%end;
run;
data _null_;