Publication quality regression tables with asdoc in Stata – video example

  • 23

Publication quality regression tables with asdoc in Stata – video example

Category:asdoc Tags : 

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. 



Leave a Reply


Nicole Martin

June 8, 2018at 10:33 pm

Firstly, thank you for making your Stata package available – it’s really speeding up my workflow compared to the other options available. I’m writing to make a suggestion that you consider adding an option that value labels can be reported in regression tables as well as variable labels.

Many thanks, and best wishes,


August 1, 2018at 1:36 am

Can ” asdoc” export the OR and 95% CI from logistic regression analysis?

    Attaullah Shah

    August 1, 2018at 2:03 am

    Dear Emily
    Version 2.0 of asdoc will have this option.


August 16, 2018at 7:00 pm

asdoc is an amazing service to the field. Appreciate it very much. Like Nicole, I would love a labels option for regression outputs. That function works great for asdoc sum, but would be of great value in this function too.

Thanks again.

Attaullah Shah

August 16, 2018at 9:37 pm

Dear Eric and Nicole, thanks for your suggestions. I am exploring the suggested possibilities. Since version 2 of asdoc is almost ready, I may come up with label option in version 3 or version 2.1.

Sher Khan

September 10, 2018at 11:39 am

Appreciate for your great work ,thank you for making your Stata package available – it’s really speeding up my workflow and saved time. Honestly , i learned a lot .
i asked one question Can asdoc command used for advance Dynamic Model ? e.g asdoc reg .. How to used for Dynamic Model to create tables ? Your response with this regard is highly appreciated

Attaullah Shah

September 10, 2018at 2:24 pm

Sher Khan, can you tell which specific Stata command are you referring to?


September 18, 2018at 5:26 am

I am excited to see this! However, I have a question. What would the code be if we want to put several models into the same table with different IVs but the same DV? So, say in the first model I want to include IV1, in the second model IV2, and so forth. But in model 6 I want to include IVs1-IVs5. What would this code look like if I’m nesting my model?

    Attaullah Shah

    September 18, 2018at 2:52 pm

    Dear Mike
    Let us say that our dependent variable is DV and our independent variables are named IV1, IV2, IV3, IV4, IV5, and IV6. You have asked that what if we run a separate regression on each independent variable and then include all independent variables in one model at the end. Then our codes would be

    asdoc reg DV IV1, replace nest cnames(IV1)
    asdoc reg DV IV2,  nest cnames(IV2)
    asdoc reg DV IV3,  nest cnames(IV3)
    asdoc reg DV IV4,  nest cnames(IV4)
    asdoc reg DV IV5,  nest cnames(IV5)
    asdoc reg DV IV6,  nest cnames(IV6)
    asdoc reg DV IV1-IV6, nest cnames(all) 


October 11, 2018at 1:56 pm

This is a wonderful tool! Thank you so much for making this available.

I see asdoc v2.0 allows ORs from ologit in the detailed table output. Is it possible to display ORs in the nested table output as well?

    Attaullah Shah

    October 11, 2018at 4:41 pm

    Justin: I missed the option eform when coding the nest option. Hopefully, I shall add it in the next update


October 12, 2018at 4:15 pm

That would so fantastic. Being able to use the reporting options, nested ORs and 95% CIs especially, to get tables directly to Word would save me hours of table-copying.

Attaullah Shah

October 12, 2018at 4:53 pm

Justin: You mean to report the 95% CIs instead of t-values or standard errors?


October 16, 2018at 5:35 pm


    Attaullah Shah

    October 16, 2018at 7:48 pm

    Justin: I have noted your suggestions and will consider them in future updates of the asdoc. Thanks.


October 27, 2018at 7:39 am

Thank You so much sir for sharing your knowledge I have one question, how can I replace t-value on se value in regression tables, I tried but it shows se value in. perenthesis in word tables.plz, guide me. best regards

    Attaullah Shah

    October 27, 2018at 10:43 am

    Ayub : I think you are referring to nested regression tables. If yes, then you can use the option rep(t), which will report t-values instead of standard errors. For example,

    sysuse auto
    asdoc reg price mpg rep78, rep(t) replace nest
    asdoc reg price mpg weight, rep(t) nest

Dr Zumin Shi

November 10, 2018at 12:08 am

I like your asdoc very much. In epidemiological research, we often focus on one independent variable (recoded into quartiles) and run multiple multivariable models (with different adjustment). The regression coefficients are often reported in one table (see below). Is it possible to do it using asdoc?





p for trend

Model 1


0.86 (0.52-1.42)

0.66 (0.40-1.11)

0.57 (0.33-0.98)


Model 2


0.85 (0.51-1.41)

0.64 (0.38-1.08)

0.58 (0.34-1.00)


Model 3


0.93 (0.54-1.61)

0.76 (0.42-1.37)

0.78 (0.43-1.43)


note: model 1 adjusted for age
model 2 further adjusted for education, and physical activity
model 3 further adjusted for hypertension.

p for trend was calculated using qartiles of fruit intake as an ordinal variable in logistic regression.
The table is based on six logistic regression models.

Bassem Hamandi

November 22, 2018at 10:24 pm

Thank you for developing this Stata package. I wonder if there is a way to export the 95% confidence interval reported after running stcox in Stata? My apologies if this is trivial but I could not find any details in the help file.
Thank you for any help you can provide.

    Attaullah Shah

    November 22, 2018at 11:29 pm

    Bassem Hamandi : Thanks for your query. Adding CI to regression tables with asdoc is on my agenda for the next update. Can you please indicate whether you want the CIs with detailed regression tables or nested tables using asdoc. You can see the help file, Section 4.1 and 4.2

Bassem Hamandi

November 22, 2018at 11:32 pm

Thank you. I am hoping to report using detailed regression tables.

Juan Miranda

November 30, 2018at 8:16 pm

Dear Attaullah Shah, good afternoon.

I’m a Stata user, but some programming things I do not understand yet.
I’ve been looking at forums like
answer to a question I have.

I am not able to make my loop save the results after regressing over files (betas, t, R2 and N), with all my datasets. I have 11 named 2005.dta to 2017.dta (except for 2009) contained in a folder (F:\datasets).

The objective is to use asdoc, and to generate a summary table of the estimates I make. The code that I have written is the following.

cd "F: \ datasets"
local i: dir. files "* .dta"
foreach file in `i '{
    asdoc reg and x1 x2 x3, append nest rep (t | se) title (Table 1 MCO per year) dec (3)

But the result is that asdoc saves the results of a single database (only the first – 2005) 11 times and does nothing for the others.

If you could have time to help me solve this problem I would thank you very much.

Cheers Juan

    Attaullah Shah

    November 30, 2018at 8:16 pm

    Juan Miranda: The question you have asked on stackoverflow is on hold, so I cannot add my answer there. The loop you are using does not use asdoc on each data set that you have. So the correct code would be:

    cd "F:\datasets"
    local i : dir "F:\datasets" files "*.dta"
    foreach file in `i' {
    use `file', clear
    asdoc reg y x1 x2 x3, append nest rep(t) title(Table 1 MCO per year) dec(3) save(reg)

    Please also note that there should be no space between rep and(t | se). The same applies to other options of asdoc.
    Also note: the option rep(t) is used to report t-statistics. Instead, if you want to report standard errors, you would use rep(se). However, you cannot use both rep(t|se). Perhaps, you copied this from the help file of asdoc, where the symbol pipe is used to denote that one of these can be used.

Leave a Reply

six − 1 =