Thanks to Kit Baum the markstat command is available through SSC. This command combines Stata code and results with a narrative written using Markdown, producing by default a web page. If a LaTeX installation is available, markstat can produce a PDF file from exactly the same input script. It requires Stata 14, whereis from SSC, and Pandoc.
The command works by separating the code from the narrative, runs the code through Stata, translates the narrative from Markdown to HTML or LaTeX using Pandoc, and then weaves the output files together. This avoid tedious cutting and pasting and promotes reproducible research.
The markstat command puts a high premium on the simplicity of the input script, which emphasizes readability much in the spirit or Markdown itself. In the simplest syntax, Stata code is indented one tab or four spaces, as in the following example from the help file:
The narrative may include equations. It may also include inline Stata or Mata code to quote results. There is an alternative strict syntax that uses code fences for Stata or Mata blocks, with an option to hide the commands and/or results. The command can also handle bibliographic citations, resolving them using a BibTeX database and listing them at the end of the document.
The markstat command is described in an article in the current issue (17-3) of the Stata Journal, and is supported by a website at http://data.princeton.edu/stata/markdown, which includes installation instructions, documentation, examples, and a comparison with the new tools in Stata 15.
The command works by separating the code from the narrative, runs the code through Stata, translates the narrative from Markdown to HTML or LaTeX using Pandoc, and then weaves the output files together. This avoid tedious cutting and pasting and promotes reproducible research.
The markstat command puts a high premium on the simplicity of the input script, which emphasizes readability much in the spirit or Markdown itself. In the simplest syntax, Stata code is indented one tab or four spaces, as in the following example from the help file:
Code:
Stata Markdown -------------- Let us read the fuel efficiency data that ships with Stata sysuse auto, clear To study how fuel efficiency depends on weight it is useful to transform the dependent variable from "miles per gallon" to "gallons per 100 miles" gen gphm = 100/mpg We then obtain a fairly linear relationship twoway scatter gphm weight || lfit gphm weight, /// ytitle(Gallons per 100 Miles) legend(off) graph export auto.png, width(500) replace  The regression equation estimated by OLS is regress gphm weight Thus, a car that weighs 1,000 pounds more than another requires on average an extra 1.4 gallons to travel 100 miles. That´s all for now!
The markstat command is described in an article in the current issue (17-3) of the Stata Journal, and is supported by a website at http://data.princeton.edu/stata/markdown, which includes installation instructions, documentation, examples, and a comparison with the new tools in Stata 15.
Comment