****************************************************************************************************
****************************************************************************************************
* PROGRAM: t4tables_output.sas
* Created (mm/dd/yyyy): 12/27/2021
*--------------------------------------------------------------------------------------------------
* PURPOSE: This macro drives the creation of T4 summary table proc report output
* - final_t4moi / final_t4gestwk
* - final_dps_t4moi / final_dps_t4gestwk
* - repdata.table&tablenum.&tableletter
* - table = table indicator from tablefile
* - dataset = input dataset
* - where = where clause to restrict &dataset
* - tabnum = table number and letter
* - nonpreg = Y/N indicator for inclusion of non-pregnant matched cohort
* - varlist = List of column names
* - varwidths = list of variable widths
* - varsmallcells = List of small cell count highlighting indicators for each column
* - columnstatementlabels = List of column headers to include in COLUMNS statement
* - definestatementlabels = List of column headers to include in DEFINE statement
* - spanningheader = Header that spans the top of entire table
* Tables T1 and T5 includes both N and # columns under a single column. For this reason, the parameter
* COLUMNLABELS contains a list of labels to include in the COLUMNS statement and COLUMNHEADERS
* contains a list of labels to include in the DEFINE statement
*--------------------------------------------------------------------------------------------------
* Sentinel Coordinating Center
* info@sentinelsystem.org
***************************************************************************************************;
%macro t4tables_output(table=,
set lookup.lookup_footnotes(where=( (type = "t4l1moi" and order in ( 0
%if &table.=T1 %then %do;
%if &nonpreg. = Y %then %do; 1 %end;
%if &table.=T5 %then %do;
%if &nonpreg. = Y %then %do; 3 %end;
or (type='type4' and order in (-2 %if &nonpreg. = Y %then %do; -1 %end;))
select count(order) into: num_fn trimmed
%if &num_fn > 0 %then %do;
select description into: fn1 - :fn&num_fn.
%assign_superscripts(type=title, order = -2 -1);
%assign_superscripts(type=exposure, order = 1 2 3 4);
/*Save dataset to repdata folder*/
%isdata(dataset=repdata.table&tabnum.);
%if %eval(&nobs.<1) %then %do;