Using asdoc is pretty easy. You need to add just asdoc as a prefix to Stata commands. For example, we use the sum command to find summary statistics of all numeric variables in the dataset. We shall add just asdoc as a prefix to sum. Let us load the auto.dta set for practice and find summary stats of all numeric variables and send the output to MS Word with asdoc
sysuse auto asdoc sum
And voila, a beautiful table of the descriptive statistic is ready [click here to see it].
And for creating a table of correlations among all numerical variables, we shall just type asdoc cor. If we were to append the results to the same file, we shall add append after the comma or leave it (append is the default, we can use replace to replace the existing file)
asdoc cor OR asdoc cor, append
More on asdoc
See also the following resources related to asdoc.
YouTube Video: Descriptive / Summary Statistics from Stata in Word with asdoc
YouTube Video: Create a publication quality table of correlation in Stata with asdoc
YouTube Video: Writing all statistics to a single Word file from Stata with asdoc
YouTube Video: Create publication quality regression tables in Stata with asdoc
Dear Sir,
I am trying to use asdoc with weighted data. But the output does not recognize the weights. Could you please help me with this problem?
Dear Professor Shah,
First of all let me congratulate you for making this fantastic program, which is a boon for stata users the world over. I am unable to add text to my regression tables, as well as save the file in another name. Below is my command:
asdoc xtologit rating_score L.log_environment_related L.lnsales L.pat_d L.lnassets L.cap_int L.int_cov L.margin L.PSII L.aud_d L.busgrp_score, dec(8) cmd stars save (Chapter_1_Tables) add (Industry Effects, Yes, Year Effects, Yes)
I am getting the error message:
(File Myfile.doc already exists, option append was assumed)
invalid ‘Yes’
r(198);
I am trying to save the file by the name Chapter_1_Tables.doc, which is not happening. In addition, I am unable to add the texts.
I am using Stata 16.1 and the most recent version of asdoc (Version 2.3.9.5 : Changes made on April 10 , 2021).
Kindly advise.
Thank you in advance.
Warm regards,
Avik
I have replied to your comment in this post.
https://fintechprofessor.com/forums/topic/asdoc-export-regression-error-invalid-yes/#post-5849
Dear Prof Shah,
Thank you so much for this Stata package! It’s the best word document generator I’ve found to date.
I was wondering if it is possible to generate more than one Word document from the same .do file. I cannot divide the code into separate .do files. I have a very large output that I wanted to channel into separate files for easier interpretation.
Thank you!!
Anisha
Hello Anisha
You can use the option
save()
for this purpose. For example, to save your first file, usesave(file1.doc)
and then to save output to another file, usesave(file2)
* First file sysuse auto, clear asdoc sum, save(file.doc) replace * Another file asdoc cor, save(file2.doc)
Thank you so much, Prof Shah!
I had another question. I noticed that in asdoc output for a chi-square test,
ex.
asdoc tab medhx_hbp_med hiv_status, col row chi exact title(High blood pressure by HIV status)
the Word output is a table but does not include the p-value.
Is there a way to output the p-value within the package? Thank you again for your help!!
Anisha
Hi,
I am trying to generate a list of IDs from a data using asdoc. when there is no observation for the condition, asdoc is generating an error “invalid syntax r(198)”.
Dear Professor Shah,
I am trying to use asdoc for numbers between 0 and 1. The problem is that when I open the Word file all numbers are rounded to the nearest integer (0 or 1) while on STATA they are perfectly displayed .
These are the commands I am using:
*Share of Capacity for each team before the change bys Homedummy: asdoc su Shareofcapacity if Season == 1314 /// | Season == 1415 | Season == 1516, save(shareofcapacity_before_after_change) /// title(Summary Statistics Share of Capacity before the change) /// replace label tzok dec(2) abb(10) *Share of Capacity for each team after the change bys Homedummy: asdoc su Shareofcapacity if Season == 1617 | Season == 1718 | /// Season == 1819, append save(shareofcapacity_before_after_change) /// title(Summary Statistics Share of Capacity after the change) label tzok dec(2) abb(10)
I do not see any visible mistake with the syntax. You can send your data that can generate the mentioned error. Send your data at attaullah.shah@imsciences.edu.pk
Hi Sir,
I have question. I use asdoc command. I cannot open the .doc file after I upgrade to the Stata17 (I could open it when I use Stata14). Instead, the hyperlink brings me to the browser which certainly makes the .doc file cannot be opened. Do you have solution for this?
thank you!
This is not related to asdoc. It is instead related to how Stata sends commands to the operating systems. The only workaround is to go the given directory and double click on the file generated by asdoc.
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.
Dear Professor,
Thanks for developing asdoc. It looks like asdoc cannot control the decimal points of coefficients and t-statistics separately. For example, most journals require to keep 3 decimal points for coefficients and 2 decimal points for t-statistics. Any advice on how can we do that in asdoc?
Thanks,
Brian
Hello Brian
I think I added this functionality to asdocx, that has several other big improvements over asdoc. See details here https://fintechprofessor.com/asdocx/wp-admin/
Dear Professor Shah,
Thanks for create the great program. I am trying put a title in a nested table, but it doesn’t work. Could you help me?
Hello,
I am trying to use “asdoc” in a fractional probit regression. This is the command I am using:
asdoc xi: fracreg probit Y X1 X2 X3 i.year i.country, vce(cluster id) add(Year dummies, Yes, Country dummies, Yes), setstars(***@.01, **@.05, *@.1), dec(4), nest replace
This command is not working. I also tried “xi: asdoc fracreg probit” but still doesn’t work. Any suggestion?
Thanks.
Hi,
I am trying to generate a list of IDs from a data using asdoc. when there is no observation for the condition, asdoc is generating an error “invalid syntax r(198)”.
Eg: asdoc list record_id if surname ==”” , title(surname-Hospital-1)
asdoc list record_id if first_name ==”” , title(first_name-Hospital-1)
if there is no observation for surname == ” ” the error appear
where there is missing in first_name and I run asdoc for surname after that it coppy the table of first_name.
I tested it with some dummy data, but the issue did not arise. Can you post an example data to replicate the said problem?
Hi,
Is there any possibility to have different decimals on different variables in asdoc tabstat?
Hello Stephan
Yes, this is possible in asdocx, which you can explore here https://fintechprofessor.com/asdocx/. There are ton of other features in asdocx as compared to asdoc.
Hello,
I’m trying to use “asdoc” command in a summary but I only get that the command is unrecognized. I try to uninstall and install the command but it did not work. Can you please give me some advise?
Thank you
Have you installed it? To install, you should run this code
Hello Dr Shah
Is it possible to use asdoc command with loops? I am trying to create multiple lists using a loop and asdoc. Here is my code:
Thanks very much
There is an error your code. asdoc should be added to the actual command, not to the line of the loop, the correct code would be
But It gives error “program error: code follows on the same line as open brace”
I assume I can not use asdoc command with a loop. Would you please help me out that how I can do this?
Thanks very much.
Ghazala
To get a helpful reply, you need to post your code. asdocx and asdocx work with and without loops.
Thanks for that amazing illustration, but I have a question :
Can I use asdoc before table1 package?
I keep getting an error!
The asdoc package does not have built-in support for the table1 package. Due to this constraint, I have incorporated table1 into asdocx, which already supports a wide range of similar packages.