asdoc : Sends Stata output to MS Word

  • 24

asdoc : Sends Stata output to MS Word

Category:Stata Programs

About asdoc

asdoc is a Stata program that makes the process of sending Stata output to MS Word super easy. asdoc creates high quality, publication-ready tables from various Stata commands such as summarize, correlate, tabstat, cross-tabs, regressions, t-tests, flexible table, and many more.


The program can be installed by typing the following from the Stata command window:

ssc install asdoc, update

Table of contents

1. Introduction

1.1 asdoc: short introduction and examples
1.2 Commands for controlling asdoc


     2. Summary Statistics

2. Summary statistics
2.1 Basic summary statistics
2.2 Customized summary statistics


     3. Correlations

3. Correlations [Blog Post]
3. Correlations [YouTube Video]


4. Regressions

       4.1 Full regression tables [YouTube Video]

4.1.1 Customizing the detailed table: Stars and CIS
4.2 Compact / nested tables (publication quality)
4.3 Regression over a grouping variable (YouTube Video)
4.4 Changing order of variables in the nested regression table


     5. Frequency tables

5.1 One-way tabulation (tabulate1)
5.2 Two-way tabulation (tabulate2)
5.3 One- and two-way tables of summary statistics (tabsum)
5.4 Multiple-way tables (tab1)
5.5 All-possible two-way tables (tab2)


6. Compact tables (tabstat)

6.1 Without groups
6.1 With groups


7. Flexible table of statistics (table)

7.1 One-way table
7.2 Two-way table
7.3 Three-way table
7.4 Four-way table


8. T-tests

8.1 one-sample t-test
8.2 two-sample using groups
8.3 two-sample using variables
8.4 paired t-test


9. Table of means, std., and frequencies (tabsum)

10. Means
10.1 Arithmetic / harmonic / geometric means
10.2 Proportions
10.3 Ratio
10.4 Total

11. Exporting the Stata Data with the sub-command list 

12. Writing matrix to a Word / RTF file

13.The survey prefix command

14.Customized tables with option row


Nicole Martin

January 10, 2018at 8:37 am

Firstly, thank you for making your Stata package available – it’s really speeding up my workflow compared to the other options available. I’m writing to make a suggestion that you consider adding an option that value labels can be reported in regression tables as well as variable labels.

Joanna Dipnall

June 1, 2018at 3:42 am

I was very excited to find your wonderful asdoc Stata command. However, I am having some issues when wanting to create some tables. The Stata value labels not being copied in tab2.

For example the value labels with foreign are not copied into my Word file:

    Attaullah Shah

    July 27, 2018at 6:23 pm

    In version 2 of asdoc, I have included value lables with all tabulation commands, i.e. tabulate, tabulated2, tab1, tab2, etc. Thanks for your suggestion.

    Attaullah Shah

    August 26, 2018at 11:06 am

    Dear Joanna
    In version 2.0 of asdoc, option label has been added for the following Stata commands when using asdoc.
    1. tabulate
    2. tabulate2
    3. tab1
    4. tab2
    5. regress and all other variants of regressions in Stata

    You can update asdoc from SSC by:
    ssc install asdoc, replace

Oscar Briones

June 10, 2018at 3:35 pm

Many thanks indeed for the “asdoc” asdoc command stata
it has helped me alot.

Richell Onnel

June 19, 2018at 10:18 pm

Thanks very nice blog

Matthew Millard

September 22, 2018at 2:16 am

I have been telling everyone about the asdoc package who uses Stata. Several people told me how much they absolutely love it. One’s exact words were that it is “game changing” for convenience.

Parek Agustino

October 7, 2018at 10:47 pm

Found this absolutely helpful. Any chance of a MacBook version(Numbers)?

Attaullah Shah

October 8, 2018at 4:29 am

Parek Augustino: asdoc can be installed on any platform where Stata is installed.

HN Panta

October 13, 2018at 4:52 pm

Hello Dr. Shah,
Thank you so much for making stata help available publicly. I am trying to create a mean and median difference between two groups with test statistics (including starts). Could you help me with this?

HN Panta

October 13, 2018at 11:19 pm

Thank you so much! I’ll send you my query soon.

Ruth-Alma Turkson-Ocran

October 24, 2018at 1:08 am

I was wondering if your asdoc program can handle survey data. I do not see the info on your blog regarding using it with the survey command (there is no hyperlink for it here: In addition,
Only one output gets put into the table when I try the following command:

foreach v of varlist married edu_cat poor2 emp_stat notcov usupl stay_us{ 
asdoc svy, subpop(if black_african==1): tab `v' sex_r, count col format(%12.0g), append

    Attaullah Shah

    October 24, 2018at 1:14 am

    Ruth-Alma: Yes asdoc can work with svy commands. Please update asdoc and it will likely solve the problem you are referring to.

    ssc install asdoc, replace

Gemechis Mersha

November 6, 2018at 3:06 pm

I would like to say thank you for your asdoc work. I found it very helpful. But I get difficulty in applying asdoc to transfer Marginal Effect result to MS Word. All the command for regression is not applicable for Marginal Effect.

For example

asdoc reg x y, replace dec(3))

…..the command dec(3) works here
but didn’t work in

asdoc margins, dydx(*), replace dec(3)

is there any asdoc special command for transferring Marginal Effect result to Word?

Dr.Öğr.Üyesi Erkan Alsu

November 23, 2018at 1:35 pm

Hi Mr. Shah I congratulate you for your asdoc program. Very nice program. I am grateful to you for bringing such a program to the world of science. Where can I find the text file on Youtube video? Where can I find the asdoc Stata codes? Thank you. Yours truly.

    Attaullah Shah

    November 23, 2018at 1:39 pm

    Thanks for your kind words. asdoc can be installed from within Stata when you are connected to the internet. Type the following in the Stata command window

    ssc install asdoc

    After installation, you can find all the help and examples in the help file. To access the help file, type

    help asdoc

Joyce Lee

November 30, 2018at 12:48 pm

Hi Dr. Shah,
I absolutely love your program, and I cannot thank you enough! I just only would like to ask how I might be able to adjust the number of stars for significance level. I would like to add asterisks with regression coefficients such that

*** are added for p<0.05, 
** for p<0.01%, and 
* for p<0.001 level of significance

. It would be of great help. Thank you!

    Attaullah Shah

    November 30, 2018at 12:52 pm

    Joyce Lee: I am working on a dozen of options to add to asdoc in its next update. I have noted your suggestion and would consider it in the next update.


December 10, 2018at 1:43 am

Hi Professor, thank you for the great program. Quick question. When I try the following command (to include year dummy):

asdoc xi: xtabond var var

, the program says no variable named xtabond. Doesn’t the program support ‘xi:’ command yet? Thank you.

Attaullah Shah

December 10, 2018at 3:17 am

Rully: Thanks for reporting this bug. I shall try to find a workaround in the next update.


December 10, 2018at 6:41 am

Thank you Professor. It’s a great program.


February 12, 2019at 3:13 pm

Hi Professor,
Is it possible for asdoc command to be in the foreach loop?

    Attaullah Shah

    February 12, 2019at 5:17 pm

    Yes, asdoc can be used in foreach loop. Please elaborate what do you want to get at the end of the loop?

Leave a Reply

eighteen + six =