The next example shows how to use Jann's esttab command in
conjunction with markstat to generate a nice table of estimates. The
code below fits two models to the fuel efficiency data and then compares
them side-by-side. We use the strict syntax and supress command echoing
to produce a dynamic report. Here is the input:
esttab.stmdA Table of Estimates
--------------------
The table below shows estimated differences in fuel efficiency between
foreign and domestic cars with and without adjustment for weight, using
gallons per 100 miles as the outcome.
```s/
quietly sysuse auto, clear
quietly gen gphm = 100/mpg
eststo clear
quietly eststo: regress gphm foreign
quietly eststo: regress gphm foreign weight
esttab
```
We see that on average foreign cars are more economical, but
if we adjust for weight they are less fuel efficient, using
`s %3.1f _b[foreign]` gallons *more* instead of one gallon
*less* per 100 miles.
<style>pre.stata { border:none; }</style>
And this is how this is rendered by the command
markstat using estimates, strict.
esttab.htmlHere we simply listed the table of estimates as part of the output. Stata output usually has a border, but I removed it with the css rule that appears at the end of the script.
An alternative is to have esttab generate a file with the table in html
format and then .include it in the document. Unfortunately the table
includes horizontal rules that conflict with Pandoc’s table borders.