Creating tables in Stata using asdoc is super-easy. In this short post, I’ll show how to use asdoc to export Stata data to MS word files. If you have not already installed asdoc, it can be installed by
ssc install asdoc
For exporting values from the data files, we can use the sub-command list of asdoc. We can also make the command conditional using the in and if qualifiers. In the following example, let us use the auto data set from the system folders
sysuse auto, clear
asdoc list price trunk mpg turn in 1/10 , replace

Explanation
In the above line of code, we wrote asdoc and the sub-command list. After that, we specified the names of the variables that we wanted to export to the MS word document. These variables included price trunk mpg turn. After that, we used the phrase in 1/10, that is the in qualifier to report observation 1 to 10. The option replace will replace any existing output file with the name Myfile.doc
AOA Sir,
I really appreciate your contribution toward the academic world
Sir, Is this command allow as to assign title of table or title to file. As we have such option in outreg command. Similarly can we use append command if we need to expand a table.
Faisal Khan: Yes, asdoc allows title(), so the above code with title will look like
The command asdoc and other as*** is very helpful
Kabir Ahmed
Thanks for your feedback. I hope you shall cite asdoc in your research.
Dear Sir,
I am amazed at how much your work has helped me in my dissertation and I will surely cite it and give it the praise it deserves.
I do have an urgent problem with the asdoc command and I will appreciate your help in the issue.
I have a numeric variable in stata, with a storage type “double”
The variable name is blood_pressure
When I run the following command
The command runs very well.
But If I run the following command
I receive the following error message:
Is there a reason why I am getting this error message?
I think you are using an old version of asdoc. If so, re-install it
If that does not solve the problem, there is a workaround. We shall first preserve the data, keep only required observations, use asdoc on that sample and again restore the full dataset
Dear Mr. Shah,
I really do like your work with asdoc.
Is there a solution within the “asdoc list” subcommand to use the variable labels instead of the variable names. The option “label” as in other asdoc commands seems to be without function.
Best regards
Juan Mueller
You have not specified whether you are asking for variable labels or value labels. I have added variable labels to asdoc now. You can download the updated version by pasting the following line in Stata
After installation, you can report variable labels instead of variable names using the label option. For example
Please tell me whether this was you were asking for. Please cite asdoc in your research.
That was a quick response!
Yes, i was looking for the variable names. It works perfect!
Thank you very much.
Hello, I am using asdoc currently and came across one issue.
I have names of locations that include French symbols and with the export to Word somehow this is not recognized. I get weird symbols where there is for example accent
(é)
and I have to correct that manually. Any idea or advice on how to fix that?Many thanks in advance!
Albena
Albena
It seems to me a Unicode issue. Please read this blog post if it can solve your problem
https://fintechprofessor.com/2019/05/23/asdoc-unicode-issue-stata-to-ms-word/
I am working on asdocx version, which will solve many other issues, including this one. Once ready, I shall email all asdoc users.
I am using ASDOC with STATA13 for the first time today, and I’m very impressed. Thank you. I am having a problem with the command:
The output in word has the date with a line feed in front of the date with the result that the date is below cases and cumulative. In stata data is formatted as type double and %td
I’ve also tried making the first column a string but that has the same problem. If I make the first column a numeric the problem goes away.
Any thoughts?
Hello Malcolm Stewart
Please send an example dataset to attaullah.shah@imsciences.edu.pk. I shall investigate the issue and get back to you.
how i can change output working directory to specific folder?
Click on the File Menu
Then click on the Change Working Directory
I appreciate your great work!
I’d like to know how to receive a table from left to right.
I don’t know why my tables come out from right to left, and I can not fix it in Word.
Do you have any idea?
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.