Exporting tables from table command was the most challenging part in asdoc programming. Nevertheless, asdoc does a pretty good job in exporting table from table command. asdoc accepts almost all options with table command, except cellwidth(#), stubwidth(#), and csepwidth(#).

 

7.1 One-way table

Example 54 : One-way table; frequencies shown by default

sysuse auto, clear
asdoc table rep78, title(Table of Freq. for Repairs) replace

 

Example 55 : One-way table; show count of non-missing observations for mpg}

asdoc table rep78, contents(n mpg) replace

Example 56 : One-way table; multiple statistics on mpg requested

asdoc table rep78, c(n mpg mean mpg sd mpg median mpg) replace

 

Example 57 : Add formatting – 2 decimals

asdoc table rep78, c(n mpg mean mpg sd mpg median mpg) dec(2) replace

 

7.2 Two-way table

Example 58 : Two-way table; frequencies shown by default

asdoc table rep78 foreign, replace

 

Example 59 : Two-way table; show means of mpg for each cell

asdoc table rep78 foreign, c(mean mpg) replace

 

Example 60 : Add formatting

asdoc table rep78 foreign, c(mean mpg) dec(2) center replace

 

Example 61 : Add row and column totals

asdoc table rep78 foreign, c(mean mpg) dec(2) center row col replace

 

7.3 Three-way table

Example 62 : Three-way table

webuse byssin, clear
asdoc table workplace smokes race [fw=pop], c(mean prob) replace

7.4 Four-way table

Example 65 : Four-way table with by()

webuse byssin1, clear
asdoc table workplace smokes race [fw=pop], by(sex) c(mean prob) replace

 

Example 66 : Four-way table with supercolumn, row, and column totals

asdoc table workplace smokes race [fw=pop], by(sex) c(mean prob) sc col row replace

5 Comments

  1. Michael Burton October 12, 2019 at 12:09 pm - Reply

    I am using asdoc and finding some issues with some commands.

    net install asdoc, from(http://fintechprofessor.com) replace

    so it should be the most recent version.

    sysuse auto, clear
    
    asdoc table rep78 foreign

    generates an error for me:

    . asdoc table rep78 foreign
    
    
    ------------------------------
    
    Repair    |
    
    Record    |      Car type    
    
    1978      | Domestic   Foreign
    
    ----------+-------------------
    
            1 |        2         .
    
            2 |        8         .
    
            3 |       27         3
    
            4 |        9         9
    
            5 |        2         9
    
    ------------------------------
    
                     aslev():  3204  super_col_var[0,0] found where scalar required
    
                   astable():     -  function returned error
    
                     :     -  function returned error

    And then also this fails:

    asdoc table rep78 foreign,row
    
    option row not allowed
    
     

    while this works:

    asdoc table rep78 foreign, row

    option row not allowed
    i.e. it requires a space before the option row…

  2. Attaullah Shah October 12, 2019 at 12:18 pm - Reply

    Hello Michael Burton
    I haved fixed both the issues.

    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.

    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.

  3. Andres Talavera Lima Peru April 16, 2020 at 5:27 pm - Reply

    ERROR asdoc table X Y , c(sum Z) replace ??
    clear all
    set more off
    use table_BD,clear
    asdoc table Wsup02a sexo if ((RESULTAD==1 | RESULTAD==2) & P019_01==. & P016==1) , c(sum P020_01) replace

    • Attaullah Shah April 16, 2020 at 6:02 pm - Reply

      Andres
      Thanks for sending the data and reporting this issue. This was the rounding problem, which would round larger digits to zeros. I 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.

      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.

      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.

  4. Andres Talavera Lima Peru April 17, 2020 at 12:25 pm - Reply

    thanks you so much. This program works very good.

Leave A Comment