Hello,
I'm having a problem with esttab. I am using Stata 17.0 SE - Standard Edition for Mac.
I am trying to export a summary statistics table from Stata to LaTex. I am following this article as a guide: https://medium.com/the-stata-guide/t...e-6e7ed5622856 since this is my first time exporting from Stata to LaTex. I started following this article's code starting from the section labeled “Tables” where they go through an example that I am applying to my own dataset. This is the code I am running:
I am having an issue on the last row where esttab is used. In the table returned, numbers only appear in the “N” column. The other 5 columns are empty.
I understand the importance of saving output in the e-class local so estout can pick this up. But, I do not understand why 5 columns of my summary statistics table do not show up after running the esttab portion of this code, considering the estpost tabstat line returned a table that was fully filled out with e(Sum), e(Mean), e(SD), etc as the column headers. I have copied the output from Stata at the end of this post, in order to make this clear.
I am also wondering what the purpose of the code c(stat) is in the estpost tabstat line?
I would greatly appreciate any advice on where I am going wrong and how to fix this issue.
Thank you,
Elaine
I'm having a problem with esttab. I am using Stata 17.0 SE - Standard Edition for Mac.
I am trying to export a summary statistics table from Stata to LaTex. I am following this article as a guide: https://medium.com/the-stata-guide/t...e-6e7ed5622856 since this is my first time exporting from Stata to LaTex. I started following this article's code starting from the section labeled “Tables” where they go through an example that I am applying to my own dataset. This is the code I am running:
Code:
ssc install estout, replace which estout which esttab est clear // clear the est locals estpost tabstat totalchildrenborn numbirthbefore25 before25conditional before16 before18 yrseduc sevenplus_edu born1982_89 born1976_81 born1970_75 born1964_69 born1958_63 born1952_57 born1946_51 muslim christian_2a otherreligion_2a hausa yoruba igbo otherethnicity lowintensity highintensity, c(stat) stat(sum mean sd min max n) ereturn list esttab, /// cells("sum(fmt(%13.0fc)) mean(fmt(%13.2fc)) sd(fmt(%13.2fc)) min max count") nonumber /// nomtitle nonote noobs label collabels("Sum" "Mean" "SD" "Min" "Max" "N")
I am having an issue on the last row where esttab is used. In the table returned, numbers only appear in the “N” column. The other 5 columns are empty.
I understand the importance of saving output in the e-class local so estout can pick this up. But, I do not understand why 5 columns of my summary statistics table do not show up after running the esttab portion of this code, considering the estpost tabstat line returned a table that was fully filled out with e(Sum), e(Mean), e(SD), etc as the column headers. I have copied the output from Stata at the end of this post, in order to make this clear.
I am also wondering what the purpose of the code c(stat) is in the estpost tabstat line?
I would greatly appreciate any advice on where I am going wrong and how to fix this issue.
Thank you,
Elaine
Code:
*Export Summary statistics to LaTex . . ssc install estout, replace checking estout consistency and verifying not already installed... all files already exist and are up to date. . . which estout /Users/elainetantalo/Library/Application Support/Stata/ado/plus/e/estout.ado *! version 3.30 25mar2022 Ben Jann . which esttab /Users/elainetantalo/Library/Application Support/Stata/ado/plus/e/esttab.ado *! version 2.1.0 19may2021 Ben Jann *! wrapper for estout . . est clear // clear the est locals . . estpost tabstat totalchildrenborn numbirthbefore25 before25conditional before16 before18 yrseduc sevenplus_edu b > orn1982_89 born1976_81 born1970_75 born1964_69 born1958_63 born1952_57 born1946_51 muslim christian_2a otherreli > gion_2a hausa yoruba igbo otherethnicity lowintensity highintensity, c(stat) stat(sum mean sd min max n) Summary statistics: Sum Mean SD Min Max count for variables: totalchildrenborn numbirthbefore25 before25conditional before16 before18 yrseduc sevenplus_edu > born1982_89 born1976_81 born1970_75 born1964_69 born1958_63 born1952_57 born1946_51 muslim christian_2a otherre > ligion_2a hausa yoruba igbo otherethnicity lowintensity highintensity | e(Sum) e(Mean) e(SD) e(Min) e(Max) e(count) -------------+------------------------------------------------------------------ totalchild~n | 23277 2.372783 2.845348 0 15 9810 numbirthb~25 | 11506 2.349602 1.811111 0 10 4897 before25co~l | 11506 2.938953 1.539665 1 10 3915 before16 | 1351 .1377166 .3446199 0 1 9810 before18 | 2343 .2388379 .4263952 0 1 9810 yrseduc | 48734 4.98048 4.795504 0 19 9785 sevenplus_~u | 3321 .3385321 .4732346 0 1 9810 born1982_89 | 2517 .2565749 .436765 0 1 9810 born1976_81 | 2056 .2095821 .4070311 0 1 9810 born1970_75 | 1758 .1792049 .3835433 0 1 9810 born1964_69 | 1446 .1474006 .3545229 0 1 9810 born1958_63 | 1183 .1205912 .3256682 0 1 9810 born1952_57 | 643 .0655454 .2474983 0 1 9810 born1946_51 | 207 .0211009 .1437281 0 1 9810 muslim | 4293 .4376147 .4961181 0 1 9810 christian_2a | 5322 .5425076 .4982152 0 1 9810 otherreli~2a | 161 .0164118 .1270595 0 1 9810 hausa | 1888 .1924567 .3942499 0 1 9810 yoruba | 1872 .1908257 .392972 0 1 9810 igbo | 1556 .1586137 .3653341 0 1 9810 otherethni~y | 4494 .458104 .498267 0 1 9810 lowintensity | 1761 .1800429 .3842429 0 1 9781 highintens~y | 8020 .8199571 .3842429 0 1 9781 . . ereturn list scalars: e(N) = 9810 macros: e(cmd) : "estpost" e(subcmd) : "tabstat" e(stats) : "Sum Mean SD Min Max count" e(vars) : "totalchildrenborn numbirthbefore25 before25conditional before16 before18 yrseduc sev.." matrices: e(Sum) : 1 x 23 e(Mean) : 1 x 23 e(SD) : 1 x 23 e(Min) : 1 x 23 e(Max) : 1 x 23 e(count) : 1 x 23 . . esttab, /// > cells("sum(fmt(%13.0fc)) mean(fmt(%13.2fc)) sd(fmt(%13.2fc)) min max count") nonumber /// > nomtitle nonote noobs label collabels("Sum" "Mean" "SD" "Min" "Max" "N") -------------------------------------------------------------------------------------------------- Sum Mean SD Min Max N -------------------------------------------------------------------------------------------------- total children eve~n 9,810 numbirthbefore25 4,897 before25conditional 3,915 before16 9,810 before18 9,810 education in singl~s 9,785 sevenplus_edu 9,810 born1982_89 9,810 born1976_81 9,810 born1970_75 9,810 born1964_69 9,810 born1958_63 9,810 born1952_57 9,810 born1946_51 9,810 muslim 9,810 christian_2a 9,810 otherreligion_2a 9,810 hausa 9,810 yoruba 9,810 igbo 9,810 otherethnicity 9,810 lowintensity 9,781 highintensity 9,781 --------------------------------------------------------------------------------------------------
Comment