## Export output of Table command from Stata to Word using asdoc

Category:UncategorizedExporting 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