Export output of Table command from Stata to Word using asdoc

  • 2

Export output of Table command from Stata to Word using asdoc

Category:Uncategorized

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

2 Comments

Michael Burton

October 12, 2019at 12:09 pm

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…

Attaullah Shah

October 12, 2019at 12:18 pm

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.

Leave a Reply

thirteen − six =