Home › Forums › ASDOC : Easy Publication Quality Tables in Stata › Restart nested table in asdoc and append mean

AuthorPosts

Alreena PintoGuestJanuary 29, 2020 at 10:33 amPost count: 118
Dear Dr.Shah,
Many thanks for asdoc command – it has been a very useful tool for documenting analysis on Stata. I’m currently using the command to generate nested regression tables and a couple of questions:
1. As part of the analysis I need to create multiple nested tables, but am struggling to end the current table and switch to the next. Is there some way to do this?
2. Is there some way to report the mean of dependent variable as part of the nested tables?
Thanks in advance for your help!
Best, AlreenaAlreena
You can use thereset
option for starting a new table. See the following example
*Example Make a nested table of 3 regressionssysuse auto, clear *First regression asdoc reg price mpg rep78, nest replace *Add variable headroom and then nest with existing table asdoc reg price mpg rep78 headroom, nest *Add variable weight and then nest with existing table asdoc reg price mpg rep78 headroom weight, nest *Start a new table, note option reset *First regression asdoc reg price mpg rep78, nest reset *Add variable headroom and then nest with existing table asdoc reg price mpg rep78 headroom, nest asdoc reg price mpg rep78 headroom weight, nest
Add additional Statistics to nested table
You can use the
add()
option to add additional text or statistics to the nested table. In the following code, I first get the mean of the dependent variable using thesum
command and write it to the local mean. Then pass on this info to the nested table using theadd(Mean,
mean’)` option.*First find mean of the dependent variable
qui sum price local mean = `r(mean)' asdoc reg price mpg rep78, nest reset add(Mean, `mean') *Second regression use turn as the dependent variable qui sum turn local mean = `r(mean)' asdoc reg turn mpg rep78 headroom, nest add(Mean, `mean')
 This reply was modified 3 years, 8 months ago by Attaullah Shah.
 This reply was modified 3 years, 8 months ago by Attaullah Shah.
 This reply was modified 3 years, 8 months ago by Attaullah Shah.
 This reply was modified 3 years, 8 months ago by Attaullah Shah.
Alreena PintoGuestJanuary 29, 2020 at 7:44 pmPost count: 118Many thanks for your prompt response.
I’ve been able to output the multiple nested tables using the reset option. However, when I add the mean of the dependent variable to these regression tables I get an error – the add option works perfectly for the first instance but the when I use the reset option and add the mean for the next set of regressions, the output “.doc” file is not readable/corrupt. Is there a reason/specific syntax that I might use to resolve this?

AuthorPosts
 You must be logged in to reply to this topic.