Customizable tables in Stata 17 Oneway tables of summary statistics
>> YOUR LINK HERE: ___ http://youtube.com/watch?v=ug0LihyIzvM
This video demonstrates how to create one-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) • Suppress the marginal totals • table () (sex), nototals • Add percentages, means, and standard deviations • table () (sex), statistic(frequency) statistic(percent) /// • statistic(mean age height weight) statistic(sd age height weight) • Format the percentages to one decimal place and display them with a % • table () (sex), statistic(frequency) statistic(percent) /// • statistic(mean age height weight) statistic(sd age height weight) /// • nformat(%9.1f percent) sformat( %s%% percent) • Format the means and standard deviations to one decimal place • table () (sex), statistic(frequency) statistic(percent) /// • statistic(mean age height weight) statistic(sd age height weight) /// • nformat(%9.1f percent) sformat( %s%% percent) /// • nformat(%9.1f mean) nformat(%9.1f sd) • /* Group the results by variable name by placing the variables • from the statistic() options on the rows */ • table (var) (sex), statistic(frequency) statistic(percent) /// • statistic(mean age height weight) statistic(sd age height weight) /// • nformat(%9.1f percent) sformat( %s%% percent) /// • nformat(%9.1f mean) nformat(%9.1f sd) • Remove the right border • collect style cell, border(right, pattern(nil)) • Change the font to arial • collect style cell, font(arial) • Preview the table • collect preview • Export the table to an Excel file • collect export table.xlsx, replace • https://www.stata.com
#############################
