Creating publication-quality tables in Stata with asdoc is as simple as adding asdoc to Stata commands as a prefix. asdoc can create two types of regression tables. The first type (call it detailed) is the detailed table that combines key statistics from the Stata’s regression output with some additional statistics such as mean and standard deviation of the dependent variable etc. This table is the default option in asdoc. The second table is a compact table that nests more than one regressions in one table (call it nested).

In this video post, I show how to use asdoc to produce the following nested table.

ALI UBAIDJune 19, 2019 at 11:15 amapologies for bothering you, I found the correct command online it was helpful and issued resolved.

Thank you for your response.

TheoJune 19, 2019 at 5:09 pmHi,

Thanks for replying.

When you use the nested function, you get SD values in parentheses under the coefficients. You also get *** for p values. And you have the dependent variable in the columns.

With the wide function, where you have the dependent variables in the rows, you do not get the SD in parentheses under the coefficients. So, i would like in the wide option to have the same model output as with the nested function, only with the dependent variables in the rows, such as with the wide option. I would like the t values to be switched out with SD in the wide option also.

Hope this is a little more clear.

Attaullah ShahJune 19, 2019 at 5:41 pmTheo

Seem you might benefit from reading the help file of asdoc. It has dozens of example on how to use the different options with the wide regression tables. What you are asking is already there. See the following example where I am reporting the SE under the regression coefficients and stars with coefficients for statistical significance.

You can read asdoc help file by

. Specifically, read Section 4.3 of the help file and examples 26 to 35.

Following are the examples of wide regressions with the mentioned options

Jana TillmannJune 25, 2019 at 12:59 amDear Professor Shah,

I am very thankful for your asdoc – breakthrough – program.

My name is Jana Tillmann and I currently write my Thesis. Hopefully, you can help me with this issue, it is very urgent as I have to hand in the thesis on Thursday.

What can I do to create a nested table with multiple additional regression statistics?

When I try to create nested regression tables, I can not find a solution to extend the tables with multiple additional regression statistics.

Here is the command I use:

If I use only one additional statistic:

–

`RMSE`

:If I use stats() instead of stat(), I don’t get any additional statistics:

If I list them separately, it only gives me the latter one:

With a wide format, it does work:

What can I do to create a nested table with a few extra regression statistics?

Attaullah ShahJune 25, 2019 at 1:00 amJana

The error you are getting is due to incorrect use of the stat() option.

Since asdoc report observations by default, there is no need to write N in the stat option.

The stat() option needs that you type comma between different statistics.

So the correct syntax would be

Please cite asdoc in your research.

In-text citationTables were created using asdoc, a Stata program written by Shah (2018).

BibliographyShah, 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.

Jana TillmannJune 29, 2019 at 1:24 pmDear Professor Shah,

I am very thankful for your asdoc – breakthrough – program.

My name is Jana Tillmann and I currently write my Thesis.

Hopefully you can help me with this issue, it is very urgent as I have to hand in the thesis on Thursday.

What can I do to create a nested table with multiple additional regression statistics?

When I try to create nested regression tables, I can not find a solution to extend the tables with multiple additional regression statistics.

Here is the command I use:

If I use only one additional statistic:

– RMSE:

If I use

`stats()`

instead of`stat()`

, I don’t get any additional statistics:If I list them separately, it only gives me the latter one:

With a wide format, it does work:

What can I do to create a nested table with a few extra regression statistics?

Attaullah ShahJune 29, 2019 at 1:27 pmI have fixed the issue.

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.

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.

Dr. Emily C. Phillips GallowaySeptember 18, 2019 at 10:43 amDear Dr. Shah,

Thank you for this wonderful program!

I’m attempting to create a regression table that contains multiple regression models, but am encountering this error:

Could you tell me what I ma doing incorrectly? I’ve updated asdoc.

Thank you!

Emily

Attaullah ShahSeptember 18, 2019 at 10:50 amDr. EmilyDue to the complex structure of the mixed command, asdoc finds it difficult to parse the command. As an alternative, asdoc offers the replay command for such cases. See this example

Travis PetersenOctober 29, 2019 at 7:51 pmHi Dr. Shah,

Thank you for your excellent work on the asdoc program. It is very useful. I was wondering if it is possible to use value labels to regression of categorical values in asdoc? Sorry to bother you, but I have looked all over and can’t seem to find an answer. For example:

Is there a way to have asdoc code for Domestic/Foreign rather than 0b.foreign/1.foreign, or do I just have to replace all of the value labels manually? Thank you very much for your time.

Attaullah ShahOctober 29, 2019 at 7:56 pmTravis Petersen

This was implemented in the new version, available on my site. For example,

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.

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.

Caroline LabordeOctober 29, 2019 at 9:43 pmHi Dr. Shah,

Thank you for your excellent work on the asdoc program. It’s amazing and very useful! I wonder if it is possible to use asdoc with xi command for logistic resgressions (and it will be great for nested regressions too)?

In fact when I use asdoc in this command

I have this message error: “sexe: string variables may not be used as factor variables”

Thanks a lot for your help and answer!!

Attaullah ShahOctober 31, 2019 at 2:05 amFor such complex syntax, you can use the replay option.

Julian LucasNovember 17, 2019 at 11:06 amGreetings Prof.

I have run this regression

but I am getting this error

what does it mean and how to solve it

Attaullah ShahNovember 17, 2019 at 12:04 pmJulian Lucas

It seems that you have updated asdoc, however, the update was not successful. Some of the old files still exist after the update, therefore, you can re-install asdoc by typing the following lines in Stata command window.

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

BibliographyShah, 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.

BrianJanuary 30, 2020 at 10:52 amDear Professor,

Thanks for maintaining asdoc. I’m wondering if asdoc could modify the variable name in regression results? I check in help.doc but I didn’t find any options. For example, we may want to change the interaction term’s displayed name.

Attaullah ShahJanuary 30, 2020 at 6:39 pmBrian

Thanks for asking. This option is currently not available in asdoc. I welcome patrons to finance specific additions to asdoc. If you are interested, please let me know and I shall work on this.

SmitaMarch 20, 2020 at 12:00 pmDear Prof. Shah,

Thank you for a wonderful program! Can you tell me how to not put stars in the nested regression outputs? Even after adding “nostars” in the command, I see the stars in the output. Am I doing something wrong?

Regards

Louis Boakye-YiadomMarch 22, 2020 at 9:54 pmHello Prof. Shah,

Is there a way of ensuring that the stars included in a regression output are attached to the regression coefficients and are not shown by themselves in a separate column? Thank you.

Attaullah ShahMarch 24, 2020 at 9:30 amThis is currently not included in the asdoc options. I have noted your point and shall consider it in future updates.

Relindis TapangApril 30, 2020 at 8:02 amThank you for this asdoc feature. Its such a great one.

I wish to find ot how to export my multinomial regression results reporting odds ratios to word.

The rests I have in word and the stata output are quite different so I dont know if I am doing something wrong.

OlenaJuly 6, 2020 at 9:25 pmHey! Thank you for as doc feature, it is great!

I stumbled upon the inability to export my multinomial regression results in odds ratios. eform command doesn’t seem to work there. Or it is me not finding the answers?

Mahvish NaeemAugust 2, 2020 at 7:36 pmThank you very much for the nice package. I would like to report adjusted R-squared instead of R-squared. I used stat(r2_a) option; it adds the adjusted R-squared; however, what I have not figured out is how to drop R-squared from the table. Is there an option available to drop R-squared from the table?

Thank you.

Niklas KurSeptember 20, 2020 at 2:45 amDear Prof. Shah,

thank you for this great tool, which is so helpful in writing research papers.

I am wondering if there is a possibility to add the “log-likelihood” value in a nested output of Logit-Regressions? Can I add any prefix in the stat() command?

Best, Niklas

Attaullah ShahSeptember 21, 2020 at 12:04 amNiklas Kur

You can add any regression statistics to the nest table using the stat() option. The log likelihood value is stored in the macro e(ll), therefore, we need to just use the option stat(ll). See this example:

Fidan AbdullayevaDecember 5, 2020 at 5:13 pmDear Dr. Shah,

I have on issue regarding the

`R2`

in my regression table. Below my codes to generate the table. I am getting the`Pseudo R2`

with`.z`

written as a result not the number. However, I want to demonstrate within`R2`

results from my fixed-effects estimation results. How can solve this issue?`asdoc xtreg fdi lrpop lremp lrgdp lropennes lroilrez lrgasrez lrbits, replace cnames(I) save(FE) nest asdoc xtreg fdi lrpop lremp lrgdp lropennes lroilrez lrgasrez lrbits vaac bitsvaac, cnames(II) save(FE) nest asdoc xtreg fdi lrpop lremp lrgdp lropennes lroilrez lrgasrez lrbits polsta bitspolsta , cnames(III) save(FE) nest asdoc xtreg fdi lrpop lremp lrgdp lropennes lroilrez lrgasrez lrbits law bitslaw, cnames(IV) save(FE) nest asdoc xtreg fdi lrpop lremp lrgdp lropennes lroilrez lrgasrez lrbits corrup bitscorrup, cnames(V) save(FE) nest asdoc xtreg fdi lrpop lremp lrgdp lropennes lroilrez lrgasrez lrbits regulator bitsregulator, cnames(VI) save(FE) nest asdoc xtreg fdi lrpop lremp lrgdp lropennes lroilrez lrgasrez lrbits govef bitsgovef, cnames(VII) save(FE) nest`

Attaullah ShahFebruary 1, 2021 at 6:11 pmFidan, asdoc reports

`R2`

correctly with the`xtreg`

command. You may like to send your sample to me for debugging. In case you want to report the`within R2`

manually, you can add the option`stata(r2_w)`

. See this example:Ana MarcanoMay 26, 2021 at 9:50 pmHello Prof.

Thank you for a very helpful package, I’m using it for my thesis and I shall cite it as you have stated.

I’m working on nested logistic regression (OR), currently it shows under parenthesis the SE, I want it to show the 95% CI instead, i tried using the level(95) command but no luck.

asdoc logit EVever i.age i.preg i.res i.wfam eduyf i.fwork ib3.wealth i.fbeatjust i.fnosexjust ib2.gtotgr, or nest fs(8) level(95) label replace

Is there a way to have nested regressions with CI instead of SE?

Thanks again!

DwsbatOctober 19, 2021 at 6:28 pmDear Prof,

Could you please help me how I can have frequencies and percentages in separate columns while I am conducting cross tabulation. Eg:

sysuse auto

asdoc tab rep78 foreign, row

Attaullah ShahNovember 6, 2021 at 10:03 amCurrently, this is not possible in asdoc. However, one can create a template for it in asdocx. See more details related to asdocx here https://fintechprofessor.com/asdocx/

APFebruary 9, 2022 at 1:15 pmDear Dr. Shah,

I am wondering if asdoc can produce regression results with t-stat on the side (in a different column next to coefficient).

sysuse auto, clear

asdoc reg price mpg rep78, replace reset nest stat(r2_a) t(side)

I want to create a table with a t-stat on the next column but not below the coefficient. Also, if I want to report only Adj. R2 but R2, what option should I use?

Thank you.

AP

QadeerAugust 16, 2022 at 9:56 pmRespected Shah

needs help gmm two-step analysis please guide me

FernandoDecember 28, 2022 at 11:00 pmHello,

I d need the table that asdoc reports to have the p-value instead standard deviation in parenthesis. Is there an option for that? I d also need the reggression to have a line in which a test is included. More specifically Hausman and AR(2) test for then panel data fixed effects reggresion

Attaullah ShahJanuary 20, 2023 at 7:52 amThis is available asdocx, that is a premium version of asdoc. See this link for example https://fintechprofessor.com/asdocx/examples/regressions/nested/sideways/

ToluNovember 29, 2023 at 8:10 amHi,

I am trying to generate a summary table of means and a t-test of group means using the asdoc code. However, I cannot figure out what is wrong with my code. I get an error message: option ( not allowed.

Below is my code:

global VAR ” var1 var2 var3 var4

foreach i in $VAR{

asdoc ttest `i’, by (mcdexpand2020) rowappend label stat(mean dif)

}

Thanks.