%assignbaselinevars(label=put(scan(metvar,-1,'_'), $charlabfmt.), grouper="Laboratory Characteristics", sortorder1=14, sortorder2=, sortorder3=input(put(scan(metvar,-1,'_'), charlabsort.),8.), sortorder4=input(put(scan(metvar,-1,'_'), charlabsort.),8.));
****************************************************************************************************
****************************************************************************************************
* 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)
* - weight, table, subgroup, subgroupcat (if reporttype = T2L2 or T4L2)
* - 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 $&baselinelabellength sortorder1 sortorder2 3 sortorder3 sortorder4 8;
grouper='Demographic Characteristics';