%baselinecomputemetrics(table=Switchstep_&switch_count., weight=Unweighted, dataout=baseline_aggregatetab%eval(7+&switch_count.), labelout=baseline_labels%eval(7+&switch_count));
****************************************************************************************************
****************************************************************************************************
* PROGRAM: baseline_compute.sas
* Created (mm/dd/yyyy): 12/11/2020
*--------------------------------------------------------------------------------------------------
* PURPOSE: The computes aggregated baseline metrics and applies labels for each row of table
* - Aggregated baseline table with the following variables:
* - group1, group2 (optional)
* - switchstep (if reporttype = T6)
* - exp_mean1-exp_mean&num_dp
* - exp_std1-exp_std&num_dp
* - exp_s2_1-exp_s2_&num_dp
* - exp_w1_1-exp_w1_&num_dp
* - exp_w2_1-exp_w2_&num_dp
* - comp_mean1-comp_mean&num_dp (if group2 populated)
* - comp_std1-comp_std&num_dp (if group2 populated)
* - comp_s2_1-comp_s2_&num_dp (if group2 populated)
* - comp_w1_1-comp_w1_&num_dp (if group2 populated)
* - comp_w2_1-comp_w2_&num_dp (if group2 populated)
* - ad1-ad_&num_dp and sd1-sd_&num_dp (if group 2 populated and covar balance computed)
* - Dataset with additional aggregated columns
* - datain: input dataset name
* - dataout: output dataset name
* - reporttype: Report type (type + level)
* - numbaselinetablegrp: number of baseline table groups
* - num_dp: number of data partners
* - stratifybydp: Y/N to format DP specific metrics
* - periodid: monitoring period #
*--------------------------------------------------------------------------------------------------
* Sentinel Coordinating Center
* info@sentinelsystem.org
***************************************************************************************************;
%macro baseline_compute(datain=, dataout=, reporttype=, numbaselinetablegrp=, num_dp=, stratifybydp=, periodid=);
%put =====> MACRO CALLED: baseline_compute;
/* Create a labels dataset for subgroup header creation */
length label $70 sortorder1 sortorder2 3;
grouper='Demographic Characteristics';