asdoc version 2 : Summary of New features | export Stata output to MS Word

  • 11

asdoc version 2 : Summary of New features | export Stata output to MS Word


Version 2.0 of asdoc is here. This version brings several improvements, adds new features, and fixes minor bugs in the earlier version. Following is the summary of new features and updates.


Brief Introduction of asdoc

asdoc sends Stata output to Word / RTF format. asdoc creates high-quality, publication-ready tables from various Stata commands such as summarize, correlate, pwcorr, tab1, tab2, tabulate1, tabulate2, tabstat, ttest, regress, table, amean, proportions, means, and many more. Using asdoc is pretty easy. We need to just add asdoc as a prefix to Stata commands. asdoc has several built-in routines for dedicated calculations and making nicely formatted tables.


How to update

The program can be updated by using the following command from Stata command window

ssc install asdoc, replace


New Features in Version 2.0

1.  Wide regression tables

This is a new format in which regression tables can be reported. In this format, the variables are shown in columns and one regression is reported per row. Therefore, this type of regressions tables is ideal for portfolios, industries, years, etc. Here is one example of a wide regression table. asdoc allows a significant amount of customization for wide tables including asterisks for showing significance, reporting t-statistics and standard errors either below regression coefficients or sideways, controlling decimal points, reporting additional regression statistics such adjusted R2, RMSE, RSS, etc., adding multiple tables in the same file, and several other features. Read this post to know more about wide table format.


2. Allowing by-group regressions

Version 2.0 of asdoc provides the convenience of estimating regressions over groups and summarizing the regression estimates in nicely formatted tables. This feature follows the Stata default of bysort prefix. This feature works with all three types of regression tables of asdoc that include detailed regression tables, nested tables, and wide tables. In this blog post, I show some examples of by-group regressions.


3. Allowing by-group descriptive statistics

Using the bysort prefix with asdoc, we can now find default, detailed, and customized summary statistics over groups. Details related to this feature will be added later on in a blog post.


4. Option label with tabulate and regress commands

Option label can now be used with regression and tabulation commands. Using this option, asdoc will report variable labels instead of variable names. In case variable labels are empty, then the variable names are reported.


5. Developing tables row by row using option row

Option row is a new feature in version 2. Option row allows building a table row by row from text and statistics. In each run of asdoc with option row, a row is added to the output table. This is a useful feature when statistics are collected from different Stata commands to build customized tables. To know more about this option, read this blog post.


6.  Accumulate text or numbers with option accum

Option accum allows accumulating text or numbers in a global macro. Once accumulated, the contents of the macro can then be written to an output file using option row.


7. Saving files in different folders

One additional feature of version 2.0 is the ability to write new files or append to existing files in different folders.




September 20, 2018at 6:07 pm

Hi, “asdoc” is very useful!
Would you give an example of its application in logistic regression or , Poisson regression analysis?

    Attaullah Shah

    September 20, 2018at 6:13 pm

    Sophia: There are three types of regression tables that asdoc can create. Can you please specify which regression table do you intend to make. The regression table types are 1. detailed table 2. nested tables and 3. wide tables. If you open the asdoc help file by typing

     help asdoc 

    in the Stata command window, there you can see further details on these regression types. See table of contents, entries 4.1, 4.2, and 4.3


October 24, 2018at 1:12 am

Hi, asdoc is wonderful.

I am running into an issue with the bysort command where the word or rtf files will not open, and Microsoft Word returns the error “Word was unable to read this document. It may be corrupt.”

example includes:

sysuse auto
bysort foreign: asdoc sum, replace
asdoc sum, replace by(foreign)

I do not have this issue when creating bysort regression output.

Any help would be greatly appreciated.

    Attaullah Shah

    October 24, 2018at 1:19 am

    Walker: Please update to version 2.2 and the problem should be solved

     ssc install asdoc, replace


October 31, 2018at 7:22 pm

Thanks for the reply. I am running v 2.2. I have uninstalled, replaced and restarted the program. I continue to get the following message when I try to open the file generated by any either version of the summary statistics over grouping variable options:

"Word was unable to read this document.  It may be corrupt.
Try one or more of the following:
* Open and Repair the file.
* Open the file with the Text Recovery converter."

    Attaullah Shah

    October 31, 2018at 8:26 pm

    Walker: Can you please do the following?:
    1. use the bysort prefix with sum command and option replace e.g.

    bys foreign: asdoc sum, replace 

    2. Send the file Myfile.doc to my email address at
    I shall investigate the source of the error. Thanks for your time and feedback.


January 10, 2019at 3:55 pm

I would like to use the bysort option, but I was wondering if you can use more than 1 varname after bysort?

    Attaullah Shah

    January 10, 2019at 4:30 pm

    You can use bysort with more than one variables by creating a grouping variable. So using the auto dataset, we can group together the variable foreign and rep78.

    sysuse auto, clear
    egen mygroup = group(foreign rep78)
    bys mygroup: asdoc sum price trunk weight, replace


January 10, 2019at 7:16 pm

Thanks for your reply. It’s working.


February 19, 2019at 4:50 pm

Is it possible to use asdoc with multinomial logistic regression in Stata

    Attaullah Shah

    February 22, 2019at 8:02 am


    Yes, it is possible. See the following example
    use, clear
    mlogit prog write, base(2)
    asdoc mlogit prog write, base(2) replace

Leave a Reply

four + 2 =