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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • Alreena Pinto
    Guest
    Post 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, Alreena

    Attaullah Shah
    Keymaster
    Post count: 69

    Alreena
    You can use the reset option for starting a new table. See the following example
    *Example Make a nested table of 3 regressions

    sysuse 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 

    asdoc reset option to start a new table in the same file


    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 the sum command and write it to the local mean. Then pass on this info to the nested table using the add(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')

    Add mean of the dependent variable to nested table of asdoc

    Alreena Pinto
    Guest
    Post count: 118

    Many 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?

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.