%assignlabelvars(format=put(&secondstrat., $&secondstrat.fmt.), sortorder1 = , sortorder2=input(put(&secondstrat., &secondstrat.sort.),1.));
****************************************************************************************************
****************************************************************************************************
* PROGRAM: t5tables_createdata.sas
* Created (mm/dd/yyyy): 08/06/2021
*--------------------------------------------------------------------------------------------------
* PURPOSE: The macro produces tables for a Type 5 report
* - agg_t5episdur.sas7bdat
* - 1 dataset per table in the format [TableID]_[StratificationOrder]
* - dataset: aggregate dataset from %aggregate_report_tables
* - whereclause: where clause to restrict input dataset
* - catvar: variable that will be categorized
* - countvar: metric counting counts
* - cattableid: category table ID from TABLEFILE
* - disttableid: distribution table ID from TABLEFILE
* - catvarsort: variable on the input dataset containing category indicators
* - createfootnote: Y/N indicator to create group-specific footnote table (for dose tables)
* - dosevar: name of variable containing statistic names for dosing tables continuous metrics
* - totalcountdosevar: name of variable containing counts for dosing tables continuous metrics
* - Censor tables are computed in a separate macro (censortable_createdata_t1t2t5.sas)
* - 'overall' stratification is required for any additional stratification
* - if CATVARSORT is specified, categories have already been computed in QRP, otherwise categories
* must be specified in the TABLEFILE for category tables
*--------------------------------------------------------------------------------------------------
* Sentinel Coordinating Center
* info@sentinelsystem.org
***************************************************************************************************;
%macro t5tables_createdata(dataset=,
%put =====> MACRO CALLED: t5tables_createdata ;
/*--------------------------------------------------------------------------------------------*/
/* Pre-processing steps: */
/* - Determine all levelIDs and stratifications requested */
/*--------------------------------------------------------------------------------------------*/
/*Set &cattableid and &disttableid to missing if not requested*/
%let table = "&cattableid.","&disttableid.";
data _tablecheck&cattableid.
_tablecheck&disttableid.;
set tablefile(where=(table in (&table.)));
if table = "&cattableid" then output _tablecheck&cattableid.;
if table = "&disttableid" then output _tablecheck&disttableid.;
%isdata(dataset=_tablecheck&cattableid.);
%if %eval(&nobs.<1) %then %do;
%isdata(dataset=_tablecheck&disttableid.);
%if %eval(&nobs.<1) %then %do;
proc datasets nowarn noprint lib=work;
if tablesub = 'overall' then order_overall=0; else order_overall=1;