### About asdoc

asdoc is a Stata program that makes it super-easy to send output from Stata to MS Word. 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.

### Installation

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.1 Correlations [Blog Post]

3.2 Correlations [YouTube Video]

3.3 Correlations with significance stars

### 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) Watch YouTube Video

5.2 Two-way tabulation (tabulate2) Watch YouTube Video

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.2 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

15. Customizing Table Titles – Tips and Tricks

## Your support helps these efforts alive

BrianJuly 18, 2021 at 10:47 amDear Professor, when I tried to export my tables using asdocx, there is an error message:

_asdoc/Tables.flexmat already exists

fopen(): 602 file already exists

write_fmtmat(): – function returned error

: – function returned error

My code is as follows:

asdocx sum `var_list’, stat(N mean sd p25 p50 p75) dec(3) tzok label ///

save(Tables.docx) ///

title(Summary Statistics)

My data and code are stored in dropbox. How can I fix the probelm? Thanks!

Attaullah ShahApril 29, 2022 at 4:27 pmDropbox creates a file sharing violation. You need to set the current directory outside Dropbox.

giuseppe simoneOctober 14, 2021 at 9:32 pmDear professors,

I used your very brilliant program to create tables. However, it seems doesn’t work perfectly on my Stata.

It doesn’t put the stars on the correlation table.

Moreover, it doesn’t restrict the number of variables chosen when I performed the des. command.

Can u help my with some advice to solve these issues?

Attaullah ShahNovember 6, 2021 at 10:05 amstars are possible only in the pwcorr command, not in the cor command. I shall add the variable restriction in asdocx, see details here https://fintechprofessor.com/asdocx/

sebastianFebruary 7, 2022 at 8:19 pmHi my ouput is some sort of html-code instead of the normal doc-format.

Any help?

Attaullah ShahApril 29, 2022 at 4:25 pmWhat command did you use, please post it here

Heike KruegerFebruary 22, 2022 at 11:47 pmDear professor,

I am really happy about your package -the first one through which you do not lose hours by formatting.

Right now I am running mixed models and I’m struggling with the Random-effects parameters: I would like to report var(_cons) and var(Residual) in my table.

However asdoc only reports lns1_1_1:_cons and lnsig_e:_cons. Is there a way to transform lns1_1_1:_cons and lnsig_e:_cons to get var(_cons) and var(Residual) in my output table? For example with a transformation option for the asdoc package?

Heres my code example:

mixed mood i.weekday || id:

asdoc replay, replace nest

Kind regards!

Attaullah ShahApril 29, 2022 at 4:26 pmSupport for mixed models is not present in asdoc. It is added to asdocx, see details related to asdocx here https://fintechprofessor.com/asdocx/

ManuelApril 29, 2022 at 6:08 pmProf. Shah:

I´m trying to use asdoc with the command menbreg (for multi-level non-binomial regression), but it does not work. It always gives me an error message.

The command I use is like this:

asdoc menbreg doctor age female i.isced1997_r ph006d16##c.bfi10_neuro|| country: bfi10_neuro, irr

After this, I receive always a message that says: “interactions not allowed”

Could you give any support for this?. Thank you in advance.

Best regards,

Manuel

Attaullah ShahApril 29, 2022 at 6:38 pmasdoc does not work with multi-level models. However, there is a way to do it in asdocx, see details related to asdocx here https://fintechprofessor.com/asdocx/

ManuelApril 29, 2022 at 7:22 pmThanks, Prof. Shah

AnmolMay 22, 2022 at 6:50 amHi. Is it possible to include plots in the word document using the asdoc command?

Attaullah ShahMay 31, 2022 at 10:41 amThis is possible in asdocx, see https://fintechprofessor.com/asdocx/options-for-docx-word-files-asdocx/export-graphs-and-charts-from-stata-to-word-with-asdocx/

Attaullah ShahJune 27, 2022 at 11:18 amPlots and graphs are available in the asdocx package, see this page https://fintechprofessor.com/asdocx/documentations/options-for-docx-word-files-asdocx/export-graphs-and-charts-from-stata-to-word-with-asdocx/

Jaan MassoAugust 10, 2022 at 12:21 pmHello

I received the following error when trying to run the asdoc command:

: 3499 asdocsum() not found

The issue may be partly related to that I am running the code not in my own computer but in the server of the statistical office, and there might be be some restrictions, e.g. we had problems in the past in running some other Stata ado files. In my own computer there was no such problems.

Many thanks!

Jaan Masso

MishaOctober 25, 2022 at 12:26 pmhi birodar. How to get xtunitroot test results via asdoc in the table below

Fisher-type unit-root test for lclenener

Based on augmented Dickey-Fuller tests

—————————————-

Ho: All panels contain unit roots Number of panels = 3

Ha: At least one panel is stationary Number of periods = 11

AR parameter: Panel-specific Asymptotics: T -> Infinity

Panel means: Included

Time trend: Not included

Drift term: Not included ADF regressions: 0 lags

——————————————————————————

Statistic p-value

——————————————————————————

Inverse chi-squared(6) P 81.4198 0.0000

Inverse normal Z -5.1377 0.0000

Inverse logit t(19) L* -12.4104 0.0000

Modified inv. chi-squared Pm 21.7718 0.0000

——————————————————————————

P statistic requires number of panels to be finite.

Other statistics are suitable for finite or infinite number of panels.

——————————————————————————

Attaullah ShahNovember 4, 2022 at 11:12 amasdoc does not have special package for xtunitroot test. However, it can be added to asdocx, that has tons of other premium features https://fintechprofessor.com/asdocx/

Zhaolin ChenJanuary 17, 2023 at 10:19 amHello

I received the following error when trying to run the asdoc command:

: 3499 delete_closing_lines() not found

How should I deal with the problem?

Many thanks!

Attaullah ShahJanuary 20, 2023 at 7:59 amI think you need to update asdoc again, try this

The new version of asdoc can be installed from my site. Copy and paste the following line in Stata and press enter.

net install asdoc, from(http://fintechprofessor.com) replace

Please note that the above line has to be copied in full. After installation of the new version, then restart Stata.

asdocx is now available

A more powerful and flexible version of asdoc is now available. I call it asdocx. You may like to check the details here

https://fintechprofessor.com/asdocx

Please do remember to cite asdoc. To cite:

In-text citation

Tables were created using asdoc, a Stata program written by Shah (2018).

Bibliography

Shah, A. (2018). ASDOC: Stata module to create high-quality tables in MS Word from Stata output. Statistical Software Components S458466, Boston College Department of Economics.

Nusrat JahanJanuary 24, 2023 at 11:19 pmHello Professor,

I am working at a Data centre where I do not have access to internet. So I had to email them the asdoc ado file. But it’s giving the error message “3499 delete_closing_lines() not found”

But asdoc worked fine on my mac even yesterday morning.

Should I also update asdoc on my mac and then resend the ado file to the data centre?

I am confused since it worked on my computer yesterday.

Is there any restriction for asdoc usage to a separate computer than on which it is installed?

Please advise how can I solve this issue.

Attaullah ShahFebruary 4, 2023 at 2:27 pmFirst update asdoc and then send to them. This bug was fixed sometime ago. You might have an old version. The new version of asdoc can be installed from my site. Copy and paste the following line in Stata and press enter.

Please note that the above line has to be copied in full. After installation of the new version, then restart Stata.

asdocx is now availableA more powerful and flexible version of asdoc is now available. I call it asdocx. You may like to check the details here

https://fintechprofessor.com/asdocx

Please do remember to cite asdoc. To cite:

In-text citation

Tables were created using asdoc, a Stata program written by Shah (2018).

Bibliography

Shah, A. (2018). ASDOC: Stata module to create high-quality tables in MS Word from Stata output. Statistical Software Components S458466, Boston College Department of Economics.

Kyla WoodwardJanuary 31, 2023 at 1:10 amHi Dr. Shah,

I love the asdoc program. I’m trying to use it to generate tables using the svy functions and it seems like it ignores the svy weighting.

This is an example of the code that gives me the values I want (proportions):

svy: tab cindly changejob if inlist(year,2021,2022), noobs row pearson

When I add asdoc, the values are reported as percentages but they are of the raw data and not the weighted values.

Is there another way to achieve the weighted output using asdoc? Or is there advanced functionality in asdocx that works with svy commands? Thank you!

Attaullah ShahFebruary 4, 2023 at 2:23 pmYou are right, asdoc does not support `svy` weights. asdocx supports `svy` with tab and other commands, see https://fintechprofessor.com/asdocx/examples/tabulation/svy-tabulate/.

SalehFebruary 7, 2023 at 9:23 amDear Prof Shah

I am trying to export summary stata for my study key variables per country. I want the number of observations per country and the mean variable for the following variables CSR score, allindrawn, New_trust climt,volunerbi..

I used the following code but it gave errors such as the option stata ( )not allowed and error 503.

the code:bys Country: sum CSR _score allindrawn New_trust climt_volunerbi,statistics(mean) replace

thanks for your help