Announcement

tabout command generating an easy cross table in word

26 Dec 2018, 03:32

Hey,
I try to create an easy cross table.
First, I used the tabulate command: tabulate variable1 variable2, column.
Now I would like to get the same output directly in MSWord. For that I tried to use the tabout command. Unfortunately with this command the numbers for one column are nor listed underneath one column and a nice grid with lines is not produced either.
This is how my command looks like atm: tabout variable1 variable2 name.doc, replace cell(col) h1(heading) h3(heading)

Thanks for your help!
Jana

Tags: None Attaullah Shah 26 Dec 2018, 04:51

Exporting output from Stata to MS Word is super easy with asdoc (can be downloaded from SSC). Following is one example of two-way tabulations. There are dozens of examples in the asdoc help file for exporting output from other Stata commands.

ssc install asdoc help asdoc sysuse auto, clear asdoc tabulate rep78 foreign , replace

Regards
--------------------------------------------------
Attaullah Shah, PhD.
Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
FinTechProfessor.com
https://asdocx.com
Check out my asdoc program, which sends outputs to MS Word.
For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

Comment

Post Cancel Jana Michel 26 Dec 2018, 08:25

Thank you very much! That command helps a lot!
With it I am able to create the following table.

Table 1 - Distribution of Looks

Key
-------------------
frequency
column percentage
+-------------------+
=1 if female
from 1 to 5 Men Women Total
Homely 8 5 13
0.97 1.15 1.03
Below average 88 54 142
10.68 12.39 11.27
Average 489 233 722
59.34 53.44 57.30
Above average 228 136 364
27.67 31.19 28.89
Strikingly beautiful 11 8 19
1.33 1.83 1.51
Total 824 436 1,260
100.00 100.00 100.00

Do you know how I to delete the unuseful information below the table title? In particular I would like to have "Category" instead of "from 1 to 5"!

Comment

Post Cancel Attaullah Shah 26 Dec 2018, 09:40

From the output you posted, it is hard to guess how your data looks like. Please post a sample of your data using dataex (from SSC). Please also post the code that you typed in Stata to generate the above table.

Regards
--------------------------------------------------
Attaullah Shah, PhD.
Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
FinTechProfessor.com
https://asdocx.com
Check out my asdoc program, which sends outputs to MS Word.
For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

Comment

Post Cancel Jana Michel 27 Dec 2018, 02:45

This is a sample of my data:
​​​​​​input float(wage lwage) byte(belavg abvavg exper looks union goodhlth black female married south bigcity smllcity service) int expersq byte educ
5.73 1.7457155 0 1 30 4 0 1 0 1 1 0 0 1 1 900 14
4.28 1.453953 0 0 28 3 0 1 0 1 1 1 0 1 0 784 12
7.96 2.074429 0 1 35 4 0 1 0 1 0 0 0 1 0 1225 10
11.57 2.4484155 0 0 38 3 0 1 0 0 1 0 1 0 1 1444 16
11.42 2.435366 0 0 27 3 0 1 0 0 1 0 0 1 0 729 16
3.91 1.3635374 0 0 20 3 0 0 0 1 1 0 1 0 0 400 12
8.76 2.1701958 0 0 12 3 0 1 0 0 1 0 1 0 0 144 16
7.69 2.0399208 0 1 5 4 1 1 0 0 0 0 0 1 0 25 16
5 1.609438 0 0 5 3 0 1 0 1 0 0 0 0 0 25 16
3.89 1.358409 0 0 12 3 0 1 0 1 0 0 0 1 0 144 12
3.45 1.2383742 0 1 3 4 0 1 0 1 0 0 1 0 0 9 12
4.03 1.3937664 0 1 6 4 0 1 0 0 1 0 0 1 0 36 16
5.14 1.637053 1 0 19 2 0 1 0 0 1 0 0 1 1 361 17
3 1.0986123 0 0 8 3 0 1 0 0 0 0 0 1 1 64 16
7.99 2.0781908 0 1 12 4 0 1 0 0 1 0 0 0 0 144 16
6.01 1.793425 0 1 17 4 0 1 0 0 1 0 0 1 0 289 16
5.16 1.6409365 0 0 7 3 0 1 0 0 1 0 0 0 0 49 17
11.54 2.445819 0 1 12 4 0 1 0 0 1 1 0 1 1 144 17
10.44 2.3456445 0 1 10 4 0 1 0 1 0 0 1 0 0 100 17

That is the code I used for the table:
asdoc tabulate looks female, replace column title(Table 1 - Distribution of Looks)