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
Thanks a trillion times! Is there a way we can specify the name of the table other than Myfile ?
Moses
Yes, you can use option save(). For example,
Good day sir. I have used the command “asdoc” to copy results like descriptive statistics, correlation matrix. However, l couldn’t copy pool mean group the full option.
Good afternoon Professor.
I have been using your command and worked perfectly, but now does not work any more. I dont know what happened.
Those are my commands:
Thank you for your help
Monica
I think you are using some older versions of Stata. Please tell me the Stata version and I shall add support for this.
Hi Professor.
I am using Stata SE 16 (64bit).
It is strange because some weeks ago that worked perfectly and then suddenly this error appeared.
Thank you very much.
Kind regards,
Monica
Monica
The problem was caused by one of the latest Stata function
ustrrtrim()
which was not available in Stata 11. I use Stata 11 to compile the code and this is why the function was never compiled. I have now used an alternative function and therow()
option works fine as before.I am having trouble using asdoc within a loop that has nested regressions. Appreciate your help.
When the variable list has just one variable the nested output is fine but with multiple variables I don’t get the table. Instead I get characters like
GSingh
remove the
reset
option from the table. Option reset should be used only when you have already created a table in a document and now want to make another table.Thank you very much! Now it works perfectly again! :)
Have a nice day.
Monica
Dear Professor,
i have been using your command frequently and I find it very helpful.
However, I had some issues using it today.
i want to use the command:
“asdoc tabstat income1 income2, by(group) statistics(sum) ”
But Stata tells me “value label group not found”
The code works with other variables instead of “group” such as gender or country.
The variable group does however exist as the command works out perfectly when I leave out the “asdic” part.
Kind regards,
Elena
Please install the latest version. 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.
If the latest version does not solve the problem, then please send an example data and the code that reproduce the error.
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.
hello, thanks for the grat code?
how can i save multiple tables? after saving the first myfile stata says “file Myfile.doc already exists
thank you!
Kabka
Can you please post the code that generates the above error?
Hi, I am trying to transfer the correlation matrix table using asdoc, however, the following error appears
I have no problem to transfer the file for regression output. Only on correlation having such problem
I just tried the following code and works without any error message
To replicate your problem, please post the exact code that you have typed in Stata. Please also update asdoc by
Please note that the above line has to be copied in full. After installation of the new version, then restart Stata.
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.
While exporting using “asdoc table x y, c(mean z) row save(results)” values are getting rounded off, I want values that are shown on the output window. what should I do?
Prerak
You can use option dec() to control the number of decimal points. See these examples
Default: three decimal points
Two decimal points
One decimal point
Sir, I want to export the result of the following:
table sec sex edustatus [pw= wgt_combined] , l m col by(agegr ) row f(%10.0f) sc
Problem is that asdoc is not accepting the pweight. What to do.
Sir, I want to export the result of the following:
table sec sex edustatus [pw= wgt_combined] , l m col by(agegr ) row f(%10.0f) sc
Problem is that asdoc is not accepting the pweight and the options : m and sc . What to do?
Hi Professor,
Thank you for the program, really amazing work.
I have an issue with exporting the following correlation matrix to Word:
it gives the following error message:
In previous messages I saw a comment to reinstall this:
However, after a restart, the whole layout and format got messed up. So I reinstalled:
This brought me back to the first problem.
Do you have a solution for exporting a correlation matrix with many variables to Word?
Thank You
Hi professor,
When using asdoc pwcorr I receive an “rtf_maker(): 3301 subscript invalid : – function returned error” error.
My command is: asdoc pwcorr Bar_downsizing Bar_brexit Bar_financialissues Bar_financialissuesonlysov Bar_futureoutlook Bar_generalissues Bar_generalissuesonlysov Bar_humanaccidents Bar_humanaccidentsonlysov Bar_internalwrongdoing Bar_labourproblems Bar_naturaldisasters Bar_naturaldisastersonlysov Bar_operationalrisk Bar_pandemics Bar_sanctions Bar_strategicproblems Bar_posfutureoutlookonlysov Bar_posfinancialonlysov Bar_positive Bar_positiveonlysov Bar_strategicrisk, star(all) nonum
It contains quite some variables. I have installed this: “net install asdoc, from(http://fintechprofessor.com) replace” however it does not help. Do you have suggestions for this problem?
Thank you so much for this amazing project; it has literally saved me hours of manual table building! Only one comment that I cannot figure out how to change the default text which appears at the end of my regression tables. For instance, after using “setstars” , my updated key did not appear in the text. Nor did the text reflect my use of robust standard errors rather than (non-robust) standard errors.
And as an update, I realized this morning that the setstars option can only accommodate 3 levels of significance and only when using asterisks to indicate significance. Attempts to specify otherwise, for example setstars(***@0.001, **@0.01, *@0.05, +@0.1), result in the table outputting the default code. Using, for example setstars(***@0.001, **@0.01, *@0.05) does however result in an update to the default text at the end of the table to accurately reflect the new significance indicators. You may want to consider updating this function in the next version to accommodate more significance levels and other symbols. Thanks again!
Ariel Zellman
Thanks for your message and suggestions. I have noted them and shall consider them in my next update.
Hello Attaullah,
I recently updated using net install asdoc, from(http://fintechprofessor.com) replace.
so that I could use no
nocf
function you mentioned was in the update.However, now that I’ve installed it, I get the
whenever I run any command.
I checked using “which” and it has your recent updates.
When I reinstall using “ssc install asdoc, replace”, everything starts working again, but then again I don’t get the new updates.
Thanks!
The error message implies that the previous version of asdoc was not fully removed from the system. The older library of function still existed somewhere on your hard-drive. To completely remove the previous installation, please copy and paste the following lines of code.
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 avaialble
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.
Hello Attaullah
I am trying to use asdoc command and want to have multiple tables in a single word file. I am using the following commands.
asdoc logit y1 x controls [pweight==weight], vce(robust) nest title(Table 2: Panel A) save(Regression) replace
asdoc logit y1 x controls [pweight==weight], vce(robust) nest title(Table 2: Panel A) save(Regression) append
asdoc ologit y2 x controls [pweight==weight], vce(robust) nest title(Table 2: Panel B) save(Regression) reset
asdoc ologit y2 x controls [pweight==weight], vce(robust) nest title(Table 2: Panel B) save(Regression) append
However, I think the “reset” option is not working and I am not getting multiple tables in a single word file. Kindly correct me where I am wrong.
Looking forward to a cordial response on this.
Thanks
Thank you for this! But I am facing a problem. I have run 2 regression models and stored the odds ratios of both models in an estimates table using eform and it is giving correct results in the stata console. However, when I am trying to export the estimates table using asdoc, the eform isn’t working anymore. In the exported results, coefficients are showing (logit model coefficients, whereas I am using logistic hence interested in the odds ratios) not the odds ratios. The code i am using-
logistic decision i.r_ma_custafford i.r_ma_mktdemo i.r_ma_adoptbarrier i.wi_pa_compadv i.wi_pa_entrybarrier i.wi_pa_supresou i.wi_pa_compresp i.wi_pa_gotomkt i.wi_tc_size i.wi_tc_mkt i.wi_tc_tech i.wi_tc_mgt i.wi_tc_exp i.wo_ret_profitability i.wo_ret_riskassess i.wo_gp_growthstrat i.wo_gp_stratsense i.wo_gp_impact if round ==1
estimates store model1
logistic decision i.r_ma_custafford i.r_ma_mktdemo i.r_ma_adoptbarrier i.wi_pa_compadv i.wi_pa_entrybarrier i.wi_pa_supresou i.wi_pa_compresp i.wi_pa_gotomkt i.wi_tc_size i.wi_tc_mkt i.wi_tc_tech i.wi_tc_mgt i.wi_tc_exp if round ==2
estimates store model2
estimates table model1 model2 eform star(0.10 0.05 0.01) ********This code is giving the odds ratio in the stata console
asdoc estimates table model1 model2 eform star(0.10 0.05 0.01) *****************This one is not exporting the odds ratio rather showing coefficients in the doc file
Pls Help!
Hello, great program though the option to flag significant correlations using spearman does not appear to be working. I’ve updated the program and restarted and the star function seems to work with pwcorr.
example code asdoc spearman var1 var2 , star(0.05)
I am impressed with ASDOC! But I am having some trouble getting it to include all of the information in my regression, such as the model, adjusted R-squared – or basically, all of the information at the very top of the output. Any advise?
If you read the help file of asdoc, you can find the stat() option in Section 4.10. The following text is copied from the help file
I love asdoc and rely on it a lot in my master thesis. Today I let the code run through and the decimal command does not work any more.
It is the same code as one month prior (the last time I let it run through) but now it does not respond to the decimal command.
The code goes like this:
asdoc wmat, mat(table1) dec(3) save(returns) title(xxx) replace
Any advice?
Thank you!
Please type the following code to show the asdoc 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.
I am using
and it works fine with dec() option
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.
Good afternoon Professor Shah
I have just discovered asdoc and like it very much :) However I am having trouble replacing or appending the files. I do one very nice table, then STATA refuses to do more, here are the commands:
asdoc tab Q9_ItemsAthome_3, save(descriptives.doc),replace
(note: file descriptives.doc not found)
file descriptives.doc could not be opened
fopen(): 603 file could not be opened
asdoc_tab_onevar(): – function returned error
: – function returned error
r(603);
Please could you advise? I am in the final stages of writing up my doctoral thesis so would very much appreciate a quick reply :=) Many thanks indeed, Alison
Is there a limit for the number of variables in the correlation matrix? I have 29 variables and i keep getting the following errors, however when running the code with half of the variables it worked
asdoccor(): 3301 subscript invalid
: – function returned error
r(3301);
Hi, thanks for asdoc, very helpful. However I’m not managing to save or append files, this is the kind of command and output I’m getting:
Many thanks if you can help,
Alison
Hello Alison
Please send an example dataset to attaullah.shah@imsciences.edu.pk. I shall investigate the issue and get back to you.
hello Professor Shah , thank you for the incredible work. please the percentages in my asdoc tables changes slightly from other tables i run without asdoc command, is there any solution to this error?
Geoorge
Can you please post your code and show the results?
Hello Sir, Thankyou for creating such a wonderful command. Sir, I have been using asdoc for months now,, suddenly it is showing some error related to directory.. I tried correcting it but not happening.. please help..
The current directory is not writable!
The current working directory is C:\WINDOWS\system32
asdoc cannot write to this directory. As a solution,
you can change to another directory with command cd
For example, try creating a folder results in drive C:,
change to that directory, and retry your asdoc command.
mkdir c:/results
cd c:/results
asdoc reg hhid count
I have been using asdoc command for many months now… Suddenly is has stopped working.. can you pls help me?? I have tried changing directory but that also not happening. Please help Sir.. And Thanks for creating such a wonderful command. \\
The current directory is not writable!
The current working directory is C:\WINDOWS\system32
asdoc cannot write to this directory. As a solution,
you can change to another directory with command cd
For example, try creating a folder results in drive C:,
change to that directory, and retry your asdoc command.
mkdir c:/results
cd c:/results
asdoc reg hhid count
Akanksha
I have replied to your query here
Dear Professor,
This program is great since it also works very well on MacOsX unlike many other STATA table printing programmes.
Is there a way to output the table in a pre-existing docx in which we are working and not a new one? Thank you,
Elena
many thanks professor..
Hello Professor!
I am amtempting to log a dofile, where I export a margins table with asdoc. However asdoc makes the logfile close, so I am not able to log my entire dofile. Do you have any solutions to this challenge?
Thank you!
Best regards,
Sebastian
Professor, how do you suppress entire columns in regression tables (e.g., t- values, R squared)?
Also, with descriptive statistics, can asdoc present the proportions % (i.e. for categorical/dichotomous variables) rather than mean?
I think the functionality you are asking for can be implemented in asdocx https://fintechprofessor.com/asdocx/
Good day Professor.
Thank you for asdoc, very helpful.
What code can I use to append “nest” for the chi-square test table? (cross-tabulation)?
asdoc does not work to export selected summary statistics when using option ” stat ( N mean) etc. It exports all the stats. please help. I am using Stata 14.1
There should be no space between
stat
and(N mean)
, it should be like thisstat(N man)