Extensive Summary Tables in Stata
Lukas Bütikofer, CTU Bern
18 November 2022
Easy-to-use: simple basic syntax
Flexible: variable-specific statistics and formatting
Type-specific defaults for continuous, categorical, count and time-to-event variables
Extensive: more than 15 descriptive statistics, 10 effect measures (with 25 confidence interval methods) and 10 tests
Customizable: user-specific descriptive statistics, effect measures and tests
Two-stage approach: keeps analysis and formatting separated
btable is available from GitHub:
https://github.com/CTU-Bern/btable
For installation the github-package is required:
| variable out_t desc_info |
|---------------------------------------------------|
1. | Total (N = 74) Descriptives |
| |
2. | mean (sd) or n (%) |
| |
3. | Price 6194 (2960) mean (sd) |
| |
4. | Weight (lbs.) 3019 (777) mean (sd) |
| |
5. | Repair record |
| |
6. | Poor 40 (54%) n (%) |
| |
7. | Good 29 (39%) n (%) |
+---------------------------------------------------+
| variable out_t |
|-----------------------------------------------------------------|
1. | Total (N = 74) |
| |
2. | Price - median (lq, uq) 5079 (4296, 6342) |
| |
3. | Weight (lbs.) - mean ± sd 3019 ± 777.2 |
| |
4. | Repair record - n (percentage, 95% CI) |
| |
5. | Poor 40 (54.1%, 42.8-64.9%) |
| |
6. | Good 29 (39.2%, 28.9-50.6%) |
+-----------------------------------------------------------------+
| variable out_t |
|--------------------------------------------------------------|
1. | Total (N = 74) |
| |
2. | Price |
| |
3. | mean (sd) 6194 (2960) |
| |
4. | median [min, lq-uq, max] 5079 [3291, 4296-6342, 15906] |
| |
5. | Weight (lbs.) |
| |
6. | mean (sd) 3019 (777) |
| |
7. | median [min, lq-uq, max] 3190 [1760, 2240-3600, 4840] |
| |
8. | Repair record - n (%) |
| |
9. | Poor 40 (54%) |
| |
10. | Good 29 (39%) |
+--------------------------------------------------------------+
| variable ns_t out_t desc_info |
|--------------------------------------------------------------------|
1. | Total (N = 74) Total (N = 74) Descriptives |
| |
2. | non-missing mean (sd) or n (%) |
| |
3. | Price 73 6194 (2960) mean (sd) |
| |
4. | Weight (lbs.) 74 3019 (777) mean (sd) |
| |
5. | Repair record 69 |
| |
6. | Poor 40 (54%) n (%) |
| |
7. | Good 29 (39%) n (%) |
+--------------------------------------------------------------------+
| variable out_t desc_info |
|-----------------------------------------------------------|
1. | Total (N = 74) Descriptives |
| |
2. | Price |
| |
3. | mean (sd) 6194 (2960) mean (sd) |
| |
4. | missing - n (%) 1 (1.4%) n (%) |
| |
5. | Weight (lbs.) - mean (sd) 3019 (777) mean (sd) |
| |
6. | Repair record - n (%) |
| |
7. | Poor 40 (54%) n (%) |
| |
8. | Good 29 (39%) n (%) |
| |
9. | missing 5 (6.8%) n (%) |
+-----------------------------------------------------------+
| variable out_t out_1 out_2 out_d pv |
|----------------------------------------------------------------------------------------------------------------------------------|
1. | Total (N = 74) Domestic (N = 52) Foreign (N = 22) Mean or risk difference (95% CI) P-value |
| |
2. | mean (sd) or n (%) mean (sd) or n (%) mean (sd) or n (%) |
| |
3. | Price 6194 (2960) 6111 (3115) 6385 (2622) -274 (-1788 to 1241) 0.72 |
| |
4. | Weight (lbs.) 3019 (777) 3317 (695) 2316 (433) 1001 (682 to 1321) <0.001 |
| |
5. | Repair record (Good) 29 (39%) 11 (21%) 18 (82%) -0.61 (-0.80 to -0.41) <0.001 |
+----------------------------------------------------------------------------------------------------------------------------------+
| desc_info effect_info test_info |
|---------------------------------------------------------------|
1. | Descriptives Effects Tests |
| |
2. | |
| |
3. | mean (sd) mean difference (95% CI) Student's t-test |
| |
4. | mean (sd) mean difference (95% CI) Student's t-test |
| |
5. | n (%) risk difference (95% CI) Fisher's exact test |
+---------------------------------------------------------------+
| variable out_1 out_2 out_d pv |
|---------------------------------------------------------------------------------------------------------|
1. | Domestic (N = 52) Foreign (N = 22) MD, MWS or OR (95% CI) P-value |
| |
2. | Price - median [lq, uq] 4816 [4187, 6303] 5759 [4499, 7140] 0.43 (0.30-0.57) 0.33 |
| |
3. | Weight (lbs.) - mean (sd) 3317 (695) 2316 (433) 1001 (682 to 1321) <0.001 |
| |
4. | Repair record (Good) - n (%) 11 (21%) 18 (82%) 0.06 (0.02; 0.21) <0.001 |
+---------------------------------------------------------------------------------------------------------+
| desc_info effect_info abbr_effec~o test_info |
|-----------------------------------------------------------------------------------------------|
1. | Descriptives Effects Effects Tests |
| |
2. | median [lq, uq] Mann-Whitney statistic (95% CI) MWS (95% CI) Wilcoxon-Mann-Whitney test |
| |
3. | mean (sd) mean difference (95% CI) MD (95% CI) Student's t-test |
| |
4. | n (%) odds ratio (95% CI) OR (95% CI) chi-squared test |
+-----------------------------------------------------------------------------------------------+
| variable out_1 out_2 out_d pv |
|-------------------------------------------------------------------------------------------------------------------------------|
1. | Domestic (N = 52) Foreign (N = 22) HR, IRR, MD or RD* (95% CI) P-value |
| |
2. | Price - mean (sd) 6111 (3115) 6385 (2622) -274 (-1788 to 1241) 0.72 |
| |
3. | Repair record (Good) - n (%) 11 (21%) 18 (82%) -0.61 (-0.80 to -0.41) <0.001 |
| |
4. | Number of checkups - n/person-time (incidence) 177/521 (0.34) 74/159 (0.47) 0.73 (0.55 to 0.97) 0.025 |
| |
5. | Accident - failures (person-time at risk) 31 (200) 10 (97) 1.5 (0.72 to 3.1) 0.28 |
+-------------------------------------------------------------------------------------------------------------------------------+
| desc_info effect_info abbr_effec~o test_info |
|-----------------------------------------------------------------------------------------------------|
1. | Descriptives Effects Effects Tests |
| |
2. | mean (sd) mean difference (95% CI) MD (95% CI) Student's t-test |
| |
3. | n (%) risk difference (95% CI) RD (95% CI) Fisher's exact test |
| |
4. | n/person-time (incidence) incidence rate ratio (95% CI) IRR (95% CI) Poisson exact test |
| |
5. | failures (person-time at risk) hazard ratio (95% CI) HR (95% CI) log-rank test |
+-----------------------------------------------------------------------------------------------------+
btable:
User-specific descriptives and effect measures: user_command(function) and user_var(varlist)
Alternative confidence intervals for effect measures
Subset of effects and tests: effects() and tests()
Hierarchical clustering: parent(varlist) and kid(varlist)
Denominator for categorical variables: denom(nonmiss)
btable_format:
Blocks: block() and block_head()
Formatting of p-values: p_digits() and p_breaks()