Customizable tables in Stata 17: Two-way tables of summary statistics
34.7 هزار بار بازدید -
3 سال پیش
-
This video demonstrates how to
This video demonstrates how to create two-way tables of summary statistics using customizable tables in Stata 17. The code below can be used to reproduce the tables shown in this video.
webuse nhanes2l, clear
Table of frequencies
table (sex race)
Suppress the totals
table (sex race), nototals
Add percentages
table (sex race), nototals statistic(freq) statistic(percent)
Add the mean and standard deviation of age
table (sex race), nototals statistic(freq) statistic(percent) ///
statistic(mean age) statistic(sd age)
Format the percentages
table (sex race), nototals statistic(freq) statistic(percent) ///
statistic(mean age) statistic(sd age) nformat(%9.1f percent) ///
sformat(%s%% percent)
Format the means and standard deviations as well
table (sex race), nototals statistic(freq) statistic(percent) ///
statistic(mean age) statistic(sd age) nformat(%9.1f percent mean sd) ///
sformat(%s%% percent)
Modify the label for the standard deviations
collect label levels result sd "SD", modify
Remove the border on the right side and change the font
collect style cell, border(right, pattern(nil)) font(arial)
Export the table to a .docx file
collect export table.docx
https://www.stata.com
webuse nhanes2l, clear
Table of frequencies
table (sex race)
Suppress the totals
table (sex race), nototals
Add percentages
table (sex race), nototals statistic(freq) statistic(percent)
Add the mean and standard deviation of age
table (sex race), nototals statistic(freq) statistic(percent) ///
statistic(mean age) statistic(sd age)
Format the percentages
table (sex race), nototals statistic(freq) statistic(percent) ///
statistic(mean age) statistic(sd age) nformat(%9.1f percent) ///
sformat(%s%% percent)
Format the means and standard deviations as well
table (sex race), nototals statistic(freq) statistic(percent) ///
statistic(mean age) statistic(sd age) nformat(%9.1f percent mean sd) ///
sformat(%s%% percent)
Modify the label for the standard deviations
collect label levels result sd "SD", modify
Remove the border on the right side and change the font
collect style cell, border(right, pattern(nil)) font(arial)
Export the table to a .docx file
collect export table.docx
https://www.stata.com
3 سال پیش
در تاریخ 1400/02/21 منتشر شده
است.
34,779
بـار بازدید شده