after reading through the forum I found that esttab often causes issues. I hope you can help me with my problem.
I am trying to create a table in stata and export it to Word. In Stata this works fine, but as soon as I export it all the data is lost.
My data contains survey results. I have data from two groups (marked by either 1 or 2).
This is how my table looks like in Stata:
group | e(Y1_5) e(Y6_10) e(totalY) e(totalX)
-------------+----------------------------------------------------------------
1 | 2.886792 3.924528 6.811321 1.867925
2 | 3.041667 3.8125 6.854167 1.708333
global list1 var1 var2 var3 var4 global format1 rtf estpost tabstat $list1, by(group) stat(mean) esttab . using Table1.$format1, replace label cells("mean(fmt(%12.0fc)")
1. I would like to have stata use my labels instead of variable names.
2. I would like to export this into Word. So far I used the code (see above) but that did not work (i.e. I got an empty table).
This is what I get in Word:
(1) | |
mean | |
Observations | 101 |
global list1 var1 var2 var3 var4 global format1 rtf estpost tabstat $list1, by(group) columns(statistics) esttab . using Table1.$format1, main(mean %12.0fc) not nostar unstack nomtitle nonumber nonote noobs label replace
To understand what all the options are for, I recommend removing the using Table1.$format1 , and then dropping one option at a time and comparing the results.
thank you for your quick response. The thing is (and I should have been more clear about that) is that I can create the table in Stata and it looks like I want it to look like (see below for a screenshot). My problem is that I can't export this to either Word nor Excel. I tried estout and esttab but they give me empty sheets. I also removed any extra options and tried the command as is:
esttab . using Table1a.csv, replace estout . using Table1a.csv, replace
The same goes for the rtf format. Female and group are both just a 0 or 1 dummy.
Any further help would be very much appreciated.
I am confused by several things.
The thing is (and I should have been more clear about that) is that I can create the table in Stata and it looks like I want it to look like (see below for a screenshot).
Your screenshot shows the results-window output from tabstat , but not from esttab or estout . If you can coax esttab or estout to give you the desired results in the results window, then it should be trivial to export those results to an RTF or CSV.
I tried estout and esttab but they give me empty sheets.In your first post, you got an RTF that was not empty. It had a model number, a dependent variable name, and a number of observations. Is this what you meant by "empty"?
I also removed any extra options and tried the command as is: [. ] The same goes for the rtf format. Female and group are both just a 0 or 1 dummy.
Firstly, you will certainly not get the intended results without specifying the option main(mean) . Secondly, I am unsure what the exact RTF results are from your description. The first RTF table you posted did not contain the words "female" or "group". Did this have something to do with the RTF/CSV export, or was it just additional information about your data?
Please show me exactly what you run, and exactly what results you receive. I suggest removing using Table1.$format1 from the command, and showing me what esttab or estout writes to the results window. Copy the commands and results straight from the results window and paste them here in a code block. Once we have that figured out, exporting to RTF or CSV should be trivial.