title =%quote(Table 1&tableletter.. Adjusted Characteristics of &grouplabel. (Propensity Score Matched, &table.), &ratiolabel.&caliperlabel., in the &database. from &startdateformatted. to &&enddate&periodid.formatted.),
****************************************************************************************************
****************************************************************************************************
* PROGRAM: baseline_output.sas
* Created (mm/dd/yyyy): 03/10/2021
*--------------------------------------------------------------------------------------------------
* PURPOSE: This macro drives the creation of Baseline Characteristics Tables proc report output
* Utility macro %baseline_procreport created to execute the proc report for each baseline table
*--------------------------------------------------------------------------------------------------
* Sentinel Coordinating Center
* info@sentinelsystem.org
***************************************************************************************************;
%macro baseline_output();
%put =====> MACRO CALLED: baseline_output;
%if %eval(&numbaselinetablegrp.>0) %then %do;
/* Set to 2 for effect estimate tables */
/*********************************************************************************************/
/*********************************************************************************************/
%macro baseline_procreport(order = ,
/*save data to reportdata folder*/
%isdata(dataset=repdata.table1&tableletter.);
%if %eval(&nobs.<1) %then %do;
%let dataset = table1_&periodid.;
/*if T6 - merge all switchsteps and create new columns*/
%if &reporttype. = T6 %then %do;
create table table1&tableletter. as
y.exp_mean&dpnum. as comp_mean&dpnum.,
y.exp_mean&dpnum._char as comp_mean&dpnum._char,
y.exp_std&dpnum. as comp_std&dpnum.,
y.exp_std&dpnum._char as comp_std&dpnum._char,
%if %eval(&maxswitch.=2) %then %do;
z.exp_mean&dpnum. as switch2_mean&dpnum.,
z.exp_mean&dpnum._char as switch2_mean&dpnum._char,
z.exp_std&dpnum. as switch2_std&dpnum.,
z.exp_std&dpnum._char as switch2_std&dpnum._char,
from table1_&periodid.(where=(order = &order. and table = 'Switchstep_0')) as x
left join table1_&periodid.(where=(order = &order. and table = 'Switchstep_1')) as y
on x.metvar = y.metvar and x.sortorder1 = y.sortorder1 and x.sortorder2 = y.sortorder2
%if %eval(&maxswitch.=2) %then %do;
left join table1_&periodid.(where=(order = &order. and table = 'Switchstep_2')) as z
on x.metvar = z.metvar and x.sortorder1 = z.sortorder1 and x.sortorder2 = z.sortorder2