As a huge fan of Stata I was super-excited about dynamic markdown documents newly available in the latest Stata 15 release. I played with the feature for the last few days, and can report that I was able to produce a decent looking markdown document using Stata. However, I also have to say that Stata’s markdown falls short of its RMarkdown alternative. Here are the reasons:

  1. Stata’s dynamic document, dyndoc, is not integrated into Stata’s development environment. I typed my dyndoc using Stata’s do-file editor. However, instead of pushing the execute button (as I would do, if I were to run a do-file), I had to go back to Stata’s command line and type and execute dyndoc command.
  2. Stata’s do-file editor is not built to handle dyndoc documents. Do-file editor treats everything as Stata code. This is good for my the code part of the document (code-chunks), but it is not good for the text part of the document. Do-file editor does not have spell check. It does not even recognize the dyndoc tags, i.e. it does not help with closing of the tags.
  3. Some of the dyndoc tags are clumsy. For example, the start and end of a code-chunk use two lines each; including graphs requires one code-chunk to create a graph, and another code-chunk to include it into the document.
  4. Dyndoc does not produce pdf. There a separate command, putpdf, which uses completely different markup language. This is in sharp contrast to the ability of RMarkdown to create html, pdf or word.
  5. Dyndoc does not support LaTex, BibTex or even outreg. This alone will be a deal-breaker for many users. Outreg is super-popular for displaying regression results but, because it generates a separate file, I was not able to include it in the dyndoc. LaTex and BibTex users should probably check out texdoc before trying out dyndoc.
  6. Dyndoc does not support publishing html to the web. Stata’s dyndoc lacks the one-button experience of publishing html that exists in RStudio. Moreover, the html created by dyndoc is not self-contained (it needs any image/figure files). This makes sharing the document cumbersome, unlike the self-contained html created by RMarkdown.
  7. Dyndoc does not support code-folding, table of contents or themes. This is mostly aesthetic, and one can certainly customize the css included in the dyndoc’s html, but RMarkdown makes creating slick-looking documents very easy. You can see dyndoc’s html here (dyndoc source code here). For comparison, the same analysis using RMarkdown is here (.Rmd source code here).

In conclusion, dyndoc is a tiny step in the right direction for Stata. Much more needs to be done to be even in the neighborhood of the flexibility, capability and the ease of use of RMarkdown. Furthermore, webdoc – a Stata command by Ben Jann – is very similar to dyndoc, and in some aspects preferable. webdoc is available for Stata 10.1 or higher, so one does not need to wait for Stata 15 (and its dyndoc)  to start writing markdown documents. A video version of this review is here.

Skip to toolbar