dtable — Create a table of descriptive statistics 21
. dtable bpsystol age weight i.race i.hlthstat, svy
Summary
N 117,157,513
Systolic blood pressure 126.946 (21.401)
Age (years) 42.253 (15.502)
Weight (kg) 71.901 (15.433)
Race
White 102,999,549 (87.9%)
Black 11,189,236 (9.6%)
Other 2,968,728 (2.5%)
Health status
Excellent 32,187,335 (27.5%)
Very good 32,176,310 (27.5%)
Good 32,715,395 (28.0%)
Fair 14,380,261 (12.3%)
Poor 5,537,956 (4.7%)
Option by() is allowed with svy. dtable also has options for tests of equality between groups
that are allowed with svy. These tests account for the survey data characteristics in your data. In the
following, we revisit the urban and rural summary table, but we add the svy option, a title, and some
notes. We also add the column(by(hide)) option to suppress the redundant label from variable
rural and add the test() suboption to rename the Test column.
. dtable bpsystol age weight i.race i.hlthstat, svy
> by(rural, nototals tests)
> column(by(hide) test(p-value))
> title(Survey data summary)
> note(Mean (Standard deviation): p-value from linear regression.)
> note(Frequency (Percent%): p-value from Pearson test.)
> note(Statistics computed using the survey weights.)
> note(Tests adjusted for the survey design.)
note: using test across levels of for , , and
.
note: using test across levels of for and .
Survey data summary
Urban Rural p-value
N 79,965,794 (68.3%) 37,191,719 (31.7%)
Systolic blood pressure 126.607 (21.438) 127.675 (21.305) 0.406
Age (years) 41.805 (15.662) 43.215 (15.112) 0.024
Weight (kg) 71.322 (15.371) 73.144 (15.493) <0.001
Race
White 67,579,394 (84.5%) 35,420,155 (95.2%) <0.001
Black 9,936,159 (12.4%) 1,253,077 (3.4%)
Other 2,450,241 (3.1%) 518,487 (1.4%)
Health status
Excellent 22,781,784 (28.5%) 9,405,551 (25.3%) <0.001
Very good 22,867,496 (28.6%) 9,308,814 (25.1%)
Good 22,089,942 (27.7%) 10,625,453 (28.6%)
Fair 8,892,926 (11.1%) 5,487,335 (14.8%)
Poor 3,229,798 (4.0%) 2,308,158 (6.2%)
Mean (Standard deviation): p-value from linear regression.
Frequency (Percent%): p-value from Pearson test.
Statistics computed using the survey weights.
Tests adjusted for the survey design.