Here is a collection of examples illustrating a number of
Each example comes with a script that you can download and run on your computer.
A Simple Script. A very simple script that reads a Stata system file, draws a graph and runs a regression.
bundle option that includes all images in base64 encoding,
making the page self-contained.
Using Metadata. A basic illustration of the two formats for including title, author and date information in your document.
Where we show how to combine Pandoc pipe tables with
markstat inline code
to produce reports that include dynamic tables.
Tables of Estimates.
An example using Ben Jann’s
esttab command with
markstat to generate a
nice table of estimates
Tables of Statistics.
tabout command can produce beautiful frequency tables and
tables of summary statistics in LaTeX or HTML
A Research Article.
The first published paper written completely with
in Demographic Research on March 22, 2017.
Introduces the use of Mata code blocks in
markstat, by reproducing part
of one of Bill Gould’s Mata Matters columns.
Thanks to the amazing Pandoc,
markstat supports bibliographic references
and citations, using many styles.
The Markstat Paper.
The article introducing
markstat, written of course using Markdown and
markstat, updated to use the bibliography option.
The Stata Tutorial.
The Stata Tutorial, which I converted to
markstat for Stata version 15
in 2017, and updated as new releases came out. Now updated for Stata 18.
Dynamic Word Documents.
Starting with version 2.0,
markstat can generate Word documents from the
same script used to produce HTML and PDF.
markstat leverages the amazing Pandoc to support presentations
in HTML with the S5 engine or in LaTeX using Beamer.
Two-Column Slides. When Pandoc added support for columns we were able to produce slides that show code and graphs side-by-side.
Quantiles in Stata and R.
markstat 2.1 and higher lets you combine Stata, Mata and R code,
which we illustrate showing how Stata and R use different defaults
when calculating quantiles.
Stata and R Tabs with Bootstrap. My computing handouts often show how to do things in Stata and R, so students have a choice of software. Here I show how to use Bootstrap tabs to select Stata and R versions of a page.
Cross-references in LaTeX. Where I expand on a Stata Forum question on cross-references, showing a solution that works with LaTeX, with a note on ongoing work on other output formats.
Stata 17 introduced a system for producing highly-customizable
publication-quality tables. Here we show two examples incorporating
such tables in
The computing logs for my courses on Multilevel Models, Survival
Analysis and Demographic Methods have all been redone using
That’s 62 examples using Stata and R.