Eliminate manual steps such as hand-editing documents
Produce a blog article from a dynamic markdown document
<<dd_do>>
sysuse auto
regress weight displacement
<</dd_do>>
. sysuse auto
(1978 Automobile Data)
. regress weight displacement
Source | SS df MS Number of obs = 74
-------------+---------------------------------- F(1, 72) = 289.52
Model | 35312313.3 1 35312313.3 Prob > F = 0.0000
Residual | 8781865.08 72 121970.348 R-squared = 0.8008
-------------+---------------------------------- Adj R-squared = 0.7981
Total | 44094178.4 73 604029.841 Root MSE = 349.24
------------------------------------------------------------------------------
weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
displacement | 7.573261 .4450891 17.02 0.000 6.685992 8.46053
_cons | 1525.276 96.74555 15.77 0.000 1332.417 1718.134
------------------------------------------------------------------------------
Attributes change a tag's behavior
<<dd_do:quietly>>
matrix define eb = e(b)
<</dd_do>>
<<dd_do:quietly>>
scatter weight displacement, mcolor(%30)
<</dd_do>>
<<dd_graph>>
<<dd_skip_if: ("`talkplace'" == "Oceania")>>
> The past was alterable. The past never had been altered.
<<dd_skip_else>>
> Oceania was at war with Eastasia. Oceania had always been at war with Eastasia.
<<dd_skip_end>>
Oceania was at war with Eastasia. Oceania had always been at war with Eastasia.
The text file might be the result of a dynamic file.
<<dd_include: subsection1.txt >>
Make a dataset containing means and variances of 100-observation samples from a lognormal distribution. Perform the experiment 10,000 times, then summarize the result:
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
mean | 10,000 1.648681 .2178435 1.038739 3.246317
var | 10,000 4.714419 4.978809 .8448562 206.9827
Produce a set of different HTML pages from one dynamic document with different arguments
The dataset is at auto_78_img.dta.
<<dd_do:quietly>>
use auto_78_img.dta, clear
desc
cap mkdir cars
<</dd_do>>
<<dd_do:nocommand>>
forval i=1/`r(N)' {
di "- [" make[`i'] "](./cars/" make[`i'] ".html)"
}
<</dd_do>>
// need use dd_remove
<<dd_do>>
forval i=1/`r(N)' {
dyndoc auto_78.txt `=make[`i']', saving("cars/`=make[`i']'.html") replace
}
<</dd_do>>
// need use dd_remove
Process dynamic tags in any text files, for example, LaTeX and JavaScript
dyntext gchart.txt, sav(gchart.html) replace
Produce a .docx document from a do-file
Produce markdown tables from commands, including