Layout:To understand the study population we generally summarize the subjects' demographic and baseline characteristics by individual treatments and a total column. These characteristics variables can be of categorical or numeric type. For categorical variables, we present the summary in the form of subject counts and percentages. The percentages can be calculated based on the number of subjects in each treatment group or based on the number of subjects with non-missing data for each categorical variable in that treatment group. Some examples of categorical variables include: Sex, Race, Ethnicity, Geographic region, Age groups etc. For numeric variables, we present the summary in the form n, mean, standard deviation, median, quaritle 1, quartile 3, minimum and maximum values. Some examples of numeric variables include: AGE, Baseline height, Baseline weight, Baseline BMI etc.
Programming flow: For categorical variables: We get the counts of number of subjects in each level of the categorical variables using an appropriate procedure like proc freq or proc sql As all levels of the categorical variable may not be present in all treatment groups, we create a dummy to present all levels, with 0 counts as needed. We get the total number of subjects in each treatment group and use them to calculate percentages We create numeric variables to sort the groups and levels within each variable as per the table presentation requirement and then transform the data as per shell requirement using procedures like proc transpose. For numeric variables: We get the required descriptive stats using a procedure like proc means or proc summary Apply appropriate rounding and convert the results into character values and concatenate the statistics as needed. We create numeric variables to sort the statistics as per shell requirement and then then transform the data as per shell requirement using procedures like proc transpose. We then combine the datasets containing the categorical variable and numeric variables and generate the report using proc report using appropriate options. We also create macro variables, either using proc sql or call symputx, for presenting the treatment totals in the column headers of the report.
Link to an example Demographics Table