This is a follow-up question to Estout and dcolumn: Overriding decimal alignment
In my case, using esttab, it centers the number of observations but it adds some decimals, for instance: Obersvations 3345.000, probably because I set se(3) or b(3) in the esttab command, which determine how many decimals are to be showed.
Any way to fix that?
esttab sex0 sex1 using men_women_aboradTTT.tex, stats(N,layout("\multicolumn{1{c}{@}") ///
label("Observations")) se(3) b(3) ///
noconstant label replace booktabs alignment(D{.}{.}{4,6}) ///
Best Answer
Includestats(N, fmt(%18.0g)
into your esttab code.Edit: Sorry, I did not see that you specify
N
to be into a multicolumn before. The following does the trick, and includes something more in additional, i.e. if you want R2 to be decimal aligned again with 3 decimal points after N (using siunitx, see below):I should add that I highly recommend switching to siunitx for decimal alignment. Have a look at Mico's answer:
And my two follow up questions:
siunitx uses math mode for symbols - workaround needed when using different fonts for math and text
siunitx: specifying custom command as input-symbol
Furthermore, I recommend using esttab with the fragment option (just include
f
in your esttab code). The table generated by esttab is then the pure table content, without headers and notes. I find when tables get a bit more complicated, esttab breaks them. You can avoid that with the fragment option.When using the fragment option, include the following to your preamble:
This creates two wrappers for esttab generated tables.
\estwide
usestabular*
and fills the table to the textwidth,\estauto
usestabular
and uses the "standard" table width (i.e. width adjusted to your content).The custom subcaptions are to include simple notes below the table using the
caption
package. You could then include a table as follows: