Create Documents with Formatted Paragraphs - The Putdocx Command

The putdocx command was added in Stata v15 and expanded in Stata v16. It allows you to create Microsoft Word documents from within Stata. The command allows you to embed Stata outputs or results as tables or paragraphs, embed Stata graphs as images, and create formatted paragraphs – all without ever having to open Microsoft Word.

In this section we look at how to create formatted paragraphs using the -putdocx- command. The default formatting for paragraphs uses the “Calibri” font, with a default size of 11 and default colour “black”. Any time you do not specify font type, size or colour, the default is used.

How to Use:

Start a new document:

Add a title:

Add a formatted paragraph:

Add bold, underline and/or italics:

Define the alignment of the paragraph:

Worked Example:

In this example I will generate several small paragraphs to showcase the different text formatting options. In the command pane I type the following:

Once the document is saved it is automatically closed and created in your current working directory. The default directory is your Documents folder, and as I haven’t changed my working directory the file is saved there. The saved file is shown below.

70 views0 comments

Recent Posts

See All