Stata 15 help for dyntext

[P] dyntext -- Process Stata dynamic tags in text file


dyntext srcfile [arguments], saving(targetfile) [options]

srcfile is a plain text file containing Stata dynamic tags. srcfile and targetfile may be any text format (.txt, .html, .do).

arguments are stored in the local macros `1', `2', and so on for use in srcfile; see [U] 16.4.1 Argument passing.

You may enclose srcfile and targetfile in double quotes and must do so if they contain blanks or other special characters.

options Description ------------------------------------------------------------------------- * saving(targetfile) specify the target file to be saved replace replaces the target file if it already exists noremove do not process <<dd_remove>> and <</dd_remove>> dynamic tags nostop do not stop when an error occurs ------------------------------------------------------------------------- * saving(targetfile) is required.


dyntext converts a dynamic text file -- a file containing both plain text and Stata commands -- to an output file in text format. Stata processes the Stata dynamic tags (see [P] dynamic tags) in the dynamic text file and creates the output text file.

If you want to convert a dynamic text file to an HTML document, see [P] dyndoc. If you want to convert a Markdown document to an HTML document, see [P] markdown.


saving(targetfile) specifies the target file to be saved. saving() is required.

replace specifies that the target file be replaced if it already exists.

noremove specifies that <<dd_remove>> and <</dd_remove>> tags should not be processed.

nostop allows the document to continue being processed even if an error occurs. By default, dyndoc stops processing the document if an error occurs. The error can be caused either by a malformed dynamic tag or by executing Stata code within the tag.


Suppose we have the file dyntext_ex.txt containing text that includes Stata dynamic tags.

To generate the output file in Stata, we type

. dyntext dyntext_ex.txt, saving(dyntext_res.txt)

The file dyntext_res.txt is saved.

You can see these files at

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index