The table 1 template
Table of Contents
The table1 template is an asdocx package that creates “Table 1”, i.e., patient baseline characteristics table commonly found in biomedical research papers. The template can summarize different types of variables such as continuous and categorical variables in a single table.
How to Use it
The template is free. However, it requires asdocx package, that is currently available at 80% discount for a limited time. The template file is installed automatically when you install asdocx.
After installation of the template, you can use the template as shown below.
asdocx tab treatvar basevars, factor(stats) continuous(stats) binary(stats) /// template(table1) cell row col
The syntax starts with the keywords
treatvar is the treatment variable, the variable that holds information of the treatment group and placebo groups.
basevars are all other variables that represent the basic characteristics of the participants.
Option template(table1) invokes the table1 template.
A Simple Example
* Load example dataset use http://fintechprofessor.com/asdocxAddins/table1.dta, clear * Make table 1 using the template(table1) option asdocx tab immigrant bone_arthritis bone_backspin /// bone_backother bone_neck bone_fibro bone_lupus /// bone_ehlers bone_deform bone_amp bone_burn nervous_ms /// nervous_seizure nervous_park nervous_stroke /// other_otherhealth other_anyother , /// template(table1) table_layout(autofit) replace
In the above example, the variable immigrant is the
treatvar and all other variables are
basevars. After comma, option
template(table1) causes asdocx to use the table1 template. The
table_layout(autofit) creates a table with tight autofit of contents. The above code should generate the following table.
Table1 template allows different statistics with categorical / factor variables, continuous variables, and binary variables. The allowed statistics are given below:
|mean||Mean of the variable|
|sd||Standard deviation of the variables|
|ci||95% Confidence interval|
|percentage||Count as Percentage of total|
|%||Count as percentage of total|
|perc||Count as percentage of total|
The statistics presented in the above table can be selectively used with categorical, binary, and continuous variables. The default statistics for each type of variables are given below:
(1) Binary variables : Count (Percentages)
(2) Categorical variables : Count (Percentages)
(3) Continuous variables : Mean (95% confidence interval)
Binary and continuous variables are identified internally by asdocx. To declare a variable as categorical, we need to add
i. as a prefix to the variable name. Two statistics can be reported with each type of variables. The first statistic is accompanied by the second one in brackets. Therefore, we wish to report frequency counts and percentages with categorical variable
ed, we need to write it as
i.ed and also add the option
cat(N %) or
cat(n %) or
cat(count perc). Let us also report mean and confidence interval with continuous variables, therefore, use the option
continuous(mean ci) See the example below.
Example of Choosing Statistics
* Load example dataset use http://fintechprofessor.com/asdocxAddins/svy.dta, clear asdocx tab back bskin wskin i.ed, factor(N %) continuous(mean ci) /// template(table1) table_layout(autofit) replace
Using it with Survey prefix svy:
Using template table1 with survey data is not much different than using any other Stata command with the svy: prefix. As a first step, declare the data as survey data and then add the svy: prefix before the tab word. Then all the statistics reported by template1 will have survey weights. See the following example
* Load example dataset use http://fintechprofessor.com/asdocxAddins/svy.dta, clear * set the survey parameters svyset SECLUSTR [pweight=NSALWTCT], strata(SESTRAT) asdocx svy: tab back bskin wskin i.ed, factor(N %) continuous(mean ci) /// template(table1) table_layout(autofit) replace
Compare results of table1 with Stata results
Example 1: Report cell percentages
The following two commands are identical as option cell is the default option for reporting cell percenatages.
asdocx tab vision denied , template(table1) replace *OR asdocx tab vision denied , cell template(table1) replace
Example 2: Report column percentages
asdocx tab vision denied , col template(table1) replace
Example 3: Report row percentages
asdocx tab vision denied , row template(table1) replace
Yearly license of asdocx is available at $9.99. Its life-time license is available at $49.99. With the asdocx membership, you get :
- Life-time license to use
- All future updates
- All premium templates / plugins.