>
BIOSTAT 212: INTRODUCTION TO DYNDOC
================================================
This is an example of a dyndoc document. It's written in Markdown syntax, and can be converted into a living MS Word or HTML document that will update the results if the data change.
To turn this file into a .docx file, save this as dyndoc_example_biostat212.txt. Then use the command dyndoc "dyndoc_example_biostat212.txt", saving("Dyndoc Example Output.docx") docx
##Setting up
At the top of your .txt file, you should include the
<>
<> command to tell STATA the version of dyndoc that you're using.
Use version 2 if you are using STATA 16 or 17, and use version 1 if you are using STATA 15.
To embed STATA commands and output, use:
~~~~
<>
commands go here
output will appear here (except graphs. more later)
<>
~~~~
<>
### Set working directory and open new log
~~~~
<>
cd "/Users/crystal/Box/_Biostat212_2021/Week7/Lecture/Demo"
clear
capture log close
log using "week7_lecture.smcl",replace
<>
~~~~
###Load Acupuncture Dataset
~~~~
<>
use "acupuncture.dta"
describe, short
<>
~~~~
##Including output in lines of text
Let's embed some statistics about our data in our text. Instead of copying and pasting the results from summarize, we can use the **dd_display** dynamic tag with **r(min)** and **r(max)** stored results:
~~~~
<>
summarize basehs
<>
The variable basehs has a minimum value <> and has a maximum value <>
~~~~
##Including Graphs
Including a graph requires 2 steps. First, you need to create the graph in the code:
~~~~
<>
histogram chronicity
<>
~~~~
Next, you need to tell dyndoc to include the graph in your output:
<>
~~~~
<>
log close
<>
~~~~