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

Поделиться
HTML-код
  • Опубликовано: 10 май 2021
  • 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
    www.stata.com
  • НаукаНаука

Комментарии • 15

  • @statacorp
    @statacorp  2 года назад +1

    You can read more in our Stata Blog posts "Customizable tables in Stata 17"
    blog.stata.com/2021/06/07/customizable-tables-in-stata-17-part-1-the-new-table-command/
    blog.stata.com/2021/06/07/customizable-tables-in-stata-17-part-2-the-new-collect-command/
    blog.stata.com/2021/06/24/customizable-tables-in-stata-17-part-3-the-classic-table-1/
    blog.stata.com/2021/08/24/customizable-tables-in-stata-17-part-4-table-of-statistical-tests/
    blog.stata.com/2021/08/26/customizable-tables-in-stata-17-part-5-tables-for-one-regression-model/
    blog.stata.com/2021/09/02/customizable-tables-in-stata-17-part-6-tables-for-multiple-regression-models/
    blog.stata.com/2021/09/08/customizable-tables-in-stata-17-part-7-saving-and-using-custom-styles-and-labels/

  • @danielricardo8902
    @danielricardo8902 Год назад +2

    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.

  • @LaurieHailer
    @LaurieHailer Год назад +1

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

  • @annazajacova2378
    @annazajacova2378 3 года назад +6

    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!

  • @InCaseofEconStruggles
    @InCaseofEconStruggles 11 месяцев назад

    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.

  • @holybob12
    @holybob12 3 года назад +1

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

  • @evaeva2300
    @evaeva2300 Год назад

    This video is great and very useful.

  • @rubaazfrali
    @rubaazfrali 3 года назад

    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!!

  • @terryharm3547
    @terryharm3547 9 месяцев назад

    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?

  • @susmitachakraborty2212
    @susmitachakraborty2212 2 года назад

    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?

    • @statacorp
      @statacorp  2 года назад

      You may want to look at this example in The Stata Blog: "Customizable tables in Stata 17, part 3: The classic table 1" (blog.stata.com/2021/06/24/customizable-tables-in-stata-17-part-3-the-classic-table-1/). In that example, Chuck includes a tabulation between hypertension and sex, and a tabulation between hypertension and race within the same table. Additionally, you can look at the example "Classic Table 1" in [R] table summary (www.stata.com/manuals/rtablesummary.pdf) for an example of a table with percentages of one variable across levels of two other categorical variables. We don't have examples using *table* with *if* and *in* , but you would specify these qualifiers before the comma and any options. Please type *help table* to view the syntax, and email us at tech-support@stata.com if you have any other questions.

  • @sebastianlundmark1091
    @sebastianlundmark1091 2 года назад +2

    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?

    • @statacorp
      @statacorp  2 года назад +3

      Click on "SHOW MORE" in the video description. We added the code for the tables shown in the video.

    • @julesa2809
      @julesa2809 2 года назад +1

      @@statacorp YES! Thank you for this

  • @TheIncredibleShrimpolino
    @TheIncredibleShrimpolino 2 года назад

    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.