*! version 2.0 2 January 2024

help for pretty_baseline Version 2.0 13 December 2023

Author

Georgia McRedmond & Rafael Gafoor
University College London, London UNITED KINGDOM
r.gafoor@ucl.ac.uk

I acknowledge the invaluable assistance of Ian White (MRC CTU) who helped to debug and test the package

Version Date Comments
1.0 26 January 2023 First release

2.0 2 January 2024 Includes options for formatting of categorical and continuous data
Option for ordering of display
Option to save the table and add a title
Median and IQR option for skewed data

Syntax

pretty_baseline
[if]
[in]
[fweight]
[,
options]

Optional
by(varname) - grouping variable by which results are to be presented

contnormal(varname) - continuous, normally distributed variables. Summary statistics of mean and standard deviation returned

contskewed(varname) - continuous, skewed variables. Summary statistics of median and interquartile range returned.

categorical(varname) - categorical variables. Summary statistics of frequency and percentages returned.

fcont(string) - format for display of continuous variables

fcateg(string) - format for display of categorical variables

title(string) - title of table

saving(string) - option to save and name baseline table

position(string) - option to change sequence of presentation of the variables of the table ("categ", "contn", "conts")

replace - specifies whether or not the file on disk is to be replaced with the version in memory if an identically named file already exists on disk

Description

pretty_baseline generates a table of baseline characteristics of publication quality.

pretty_baseline generates grouped results by any categorical variable with greater than or equal to 2 groups.
If there is missingness in the grouping variable, a column with missing values will be produced. There are 4 types of data which
are accommodated. Normally distributed continuous variables, continuous variables with a skewed distribution, categorical variables.
For continuous variables the mean and standard deviation or the median and inter quartile range (IQR) will be produced respectively
for normally distributed or for skewed data. The default number of decimal places for all statistics for continuous data are two
decimal places after the decimal point. For categorical data, the counts and percentages are shown. The percentage output
has a default of 1 decimal place. The decimal place options can be changed for either categorical or continuous data using the fcateg
or fcont options. Guidance can be found in Stata help files for the formatting options [format].

The default sequence of vertical presentation of the categoriesof variables is output in:"normally distributed continuous", "skewed continuous" and "categorical".
This default can be changed with the option position. The input accepts a sequence of strings "contn", "conts" and "categ".

The default table is saved as an .docx document, however can be invoked as the table is retained in memory. To recall the
table the command collect layout can be issued to the console. The default location for the resultant file is the working directory
although another file location can be specified.

The default variable labels for the table are the value labels from the dataset. Where value labels are not specified, variable names will be presented.

Examples

. webuse nhanes2l, clear

Second National Health and Nutrition Examination Survey

Basic table

. pretty_baseline, by(sex) contn(age) conts(height weight) categ(race)

Basic table with no grouping variable

. pretty_baseline, contn(age) conts(height weight) categ(race)

Table with formatting of output

. pretty_baseline, by(sex) contn(age) conts(height weight) categ(race) fcont(%9.3fc) fcateg(%9.1fc)

Table with formatted output, title, saving word document, and changing order of output

. pretty_baseline, by(sex) contn(age) conts(height weight) categ(race) fcont(%9.3fc) fcateg(%9.1fc) ///

title(Table 1: Table of Baseline Characteristics) saving(Table_1) position("conts" "contn" "categ")