Options for docx (Word) files

asdocx uses asdocx_defaults.ado file to set options permanently. For more details on this, please visit this section. In this section, we are going to understand how to change various formatting options for the current session. Once set, these options are sticky and will be used by asdocx until Stata is restarted or the option is set to a different value.

1. save(file_name)

The default file file name is MyFile.docx. However, this can be changed using the save(file_name.ext) option. So, let say we wish to save the file as Panel Data Regression, where y x1 x2 x3 are variables in our dataset, our regression code will be:

asdocx reg y x1 x2 x3, save(Panel Data Regression) replace

Since .docx is the default, we can skip it from the file name to save some typing. However, the following code also works. Please note the .docx addition to the file name. If we were to send the results to MS Excel, then typing .xlsx is must.

asdocx reg y x1 x2 x3, save(Panel Data Regression.docx) replace


2. append / replace

The default behavior of asdocx is to append tables and contents to the existing file, therefore, option append is option. Option replace is used to replace any existing file.

3. Font size

The default font size is 12 points. This can be changed to any desired value using the fs(#) option. Therefore, to set the font size as 14 pt, the code would be

asdocx sum, replace fs(14)

4. Font family

The default font family is Garamond. This can be changed using the font(fontname) option. fontname may be any valid font installed on the user’s computer. Let say we wish to change the font family to Arial, the code would be:

asdocx sum, replace font(Arial)


5. Decimal points

The default is to report three decimal points. This can be changed using the dec(#) option. The following code  reports 4 decimal points:

asdocx sum, replace dec(4)


6. Document orientation

The default layout is portrait. To change document orientation to landscape:

* Use landscape orientation
asdocx sum, replace landscape
 * Change back to Portrait asdocx sum, replace portrait


7. Paper size

The possible values for paper are letterlegalA3A4, and B4JIS. The default paper size is A4, to change it to legal, use option paper(legal):

asdocx sum, paper(Legal)


8. Table layout

The table layout can be fixed, autofit or auto. The default is fixed. The fixed layout sets the same width for all columns in the table. It is similar to the Fixed-Column Width in MS Word. When auto is specified, the column width automatically resizes to fit the window. It is similar to ‘AutoFit-Window‘ in MS Word. When autofit is specified, the table width is determined by the overall table layout algorithm, which automatically resizes the column width to fit the contents.  In MS Word parlance, it is similar to ‘AutoFit-Contents‘. For tables with many columns, it is recommended to use the autofit or auto option. One example could be to report the detailed summary statistics using autofit option. To set the table layout to autofit:

asdocx sum, detail table_layout(autofit)


9. Table Title

Table title is set using the title(title text) option. Therefore, if the desired table title is Table 5: Descriptive Statistics, the code would be:

asdocx sum, detail title(Table 5: Descriptive Statistics)


10. Table alignment

To set the table alignment, use option table_align().    The possible values for this option are leftright, and center. Note that setting the table alignment has no visible effect if the table has the default width.

* Set the table align to left
asdocx sum, detail table_align(left)


11. Page breaks

Page breaks can be added with the option pagebreak(before) or pagebreak(after). pagebreak(before) inserts a page break before a given table. pagebreak(after) inserts a page break after the table.