6 Stata Output and cleanlog

6.1 Removing Stata Code from Output

Statamarkdown removes the echoed Stata code from your Stata output by default, and echoes it in a separate block in your text before the output.

6.2 Restoring Stata Code to Output

To show Stata code mixed with the Stata output (this is the style used in official Stata documentation), use chunk options cleanlog=FALSE and echo=FALSE.

```{stata official, cleanlog=FALSE, echo=FALSE} 
sysuse auto
summarize
```

Which produces this result:

. sysuse auto
(1978 automobile data)

. summarize

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
        make |          0
       price |         74    6165.257    2949.496       3291      15906
         mpg |         74     21.2973    5.785503         12         41
       rep78 |         69    3.405797    .9899323          1          5
    headroom |         74    2.993243    .8459948        1.5          5
-------------+---------------------------------------------------------
       trunk |         74    13.75676    4.277404          5         23
      weight |         74    3019.459    777.1936       1760       4840
      length |         74    187.9324    22.26634        142        233
        turn |         74    39.64865    4.399354         31         51
displacement |         74    197.2973    91.83722         79        425
-------------+---------------------------------------------------------
  gear_ratio |         74    3.014865    .4562871       2.19       3.89
     foreign |         74    .2972973    .4601885          0          1

. 

This page was written using:

  • Statamarkdown version 0.9.2
  • knitr version 1.45