Customizable tables in Stata 17: Two-way tables of summary statistics

preview_player
Показать описание
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

Рекомендации по теме
Комментарии
Автор

You can read more in our Stata Blog posts "Customizable tables in Stata 17"

statacorp
Автор

I love you with all my hearth you literally save my Econometrics 1 final project, here I am at 4:30 am eternally gratefull for you.

danielricardo
Автор

Dr Huber, this is a great video on an amazing new utility in Stata. However, could you please also show the commands for those of us who don't use the point-an-click interface? In future videos, that is? The commands are mostly obscured by the dialog window... Thanks!

annazajacova
Автор

This is a great video on tables, thanks Dr. Huber! The code in the description is super helpful as well. There is a lot you can do in the actual do-file with this code, and esttab/estout is also useful for outputting table results to Word/Excel/Latex.

InCaseofEconStruggles
Автор

This is great, as usual! Thanks, Chuck Huber!

LaurieHailer
Автор

Thanks for the tutorial. Is it possible to include Pearson's Chi-square and Fisher's exact test P-values?

holybob
Автор

Great functions! Would it be possible to paste the full command in the comment to the video for those of us who love syntax and hate clicking?

sebastianlundmark
Автор

Thank you so much for this vedio!!! how can you display the output of chi2 or Fisher exact test?? I dont get the P-value in the result!!

rubaazfrali
Автор

Thank you for this video, very helpful, Can you tell me is there a way to save these commands, so I can run the same table in the future without re-creating from scratch?

terryharm
Автор

Hi Dr. Huber, can you please show how we can customize tables with "if/in" conditions, and how we can create tables with two separate cross-tabs to create one single table?

susmitachakraborty
Автор

I wanted to try the new feature to quickly export some easy cross-tabulations to Excel for a project. Every "tutorial" is needlessly complicated and I now decided to use some old syntax using tabout, putexcel etc. Thanks for nothing. If you come up with a new feature for a simple function, it should be easier than what was there before.

MisterGordonZola