# 14 Stata Help in Markdown

## 14.1 Introduction

For some Stata documentation, you may want to include portions of Stata's help files.

When I present workshops on Stata programming topics, I often refer to the Help files. I use them constantly myself, and I usually want my audience to learn to do the same.

I can usually just write "look up *command name*" or provide
a URL. But every once in a while, I want to include something from a
Help file in my own writing. Sometimes I want to make a point about
how the Help itself is laid out.

## 14.2 Example - help graph

For example, I recently found myself wanting to discuss some of the
many tasks accomplished with Stata's `graph`

command, and it is useful
to look at how Stata has grouped these in its own documentation. In
Stata, type the command:

What you will see in the Help (below) is that the first group of
`graph`

commands draw graphs, that is, they specify how the ink is
to go on the page (pixels on the screen), and then carry out that task.

The other `graph`

commands, grouped further down, are utility procedures
that mostly manipulate a graph that has been produced. (I have only
included part of the Help page here.)

```
[G-2] graph -- The graph command
(View complete PDF manual entry)
Syntax
graph ...
The commands that draw graphs are
Command Description
---------------------------------------------------------------------
graph twoway scatterplots, line plots, etc.
graph matrix scatterplot matrices
graph bar bar charts
graph dot dot charts
graph box box-and-whisker plots
graph pie pie charts
other more commands to draw statistical graphs
---------------------------------------------------------------------
The commands that save a previously drawn graph, redisplay previously
saved graphs, and combine graphs are
Command Description
---------------------------------------------------------------------
graph save save graph to disk
graph use redisplay graph stored on disk
graph display redisplay graph stored in memory
graph combine combine multiple graphs
graph replay redisplay graphs stored in memory and on disk
---------------------------------------------------------------------
```

## 14.3 The R Markdown

There are three steps to this little display:

- a fake call to
`help graph`

. This is faked because it is a command Stata would ignore in batch mode. - a hidden
`translate`

command (in Stata). This converts Stata's marked up (SMCL) help into plain text. - a hidden
`readLines`

command (in R). This gives us our "output" in the document.

To see the details, see the source.

*(This page was written using Statamarkdown version 0.9.2.)*