--- title: "Template for Stata Documentation" author: "Doug Hemken" date: "January 2017" output: html_document: includes: in_header: ../Rmd/headKBprod.html before_body: ../Rmd/topKBprod.html after_body: ../Rmd/bottomKBprod.html css: ../Rmd/Rmd.css self_contained: no theme: null highlight: null toc: yes --- ```{r setup, echo=FALSE, message=FALSE} source("StataMDsetup.r") ``` # Introduction Some example Stata code - a code block and the logged note: ```{r data, collectcode=TRUE} sysuse auto generate gpm = 1/mpg ``` A continued example - code and log: ```{r ttest} ttest gpm, by(foreign) ``` A graph, (cleaned) code with the log hidden: ```{r graphs, results="hide"} graph twoway scatter gpm weight graph export "scatter.png", replace ``` The resulting graph: ![Individual data](scatter.png) And some hidden cleanup follows. ```{r, engine='R', echo=FALSE, message=FALSE} unlink("profile.do") ```