> > Is there a way to get the results from a table command into a matrix
> > or CSV file? In the end I want in Excel.
> >
> > The command I'm running is:
> > table x y, c(sum z mean z) row col
> >
> > I know there are things like this for reg, tabstat, sum etc but can't
> > find anything for "table" and can't easily replicate the format using
> > other commands.
1)a simple-yet-effective-(yet-inefficient) option is to use log2html.
It will require copying and pasting, but the table will be correctly
formated.
copy and paste (from your browser) the table. It will (usually) paste
as one column. Do Data>Text to Columns>fixed>finish.
2) use the -replace- option. This changes the data as -collapse- does,
but is just an option on table. I assume you have a .do file, but
basically:
---do file----
*table 1
use foo.dta, clear
table table x y, c(sum z mean z) row col replace
outsheet using table1, comma replace
*table 2
use foo.dta, clear
table table a b, c(sum z mean z) row col replace
outsheet using table2, comma replace
--------enddo-------------
Just a matter of taste and particulars...
The table problem is somewhat interesting, as if I am doing this on
the fly, in Windows when I right click, I have the option of "copy
table", which correctly (via tabs?) delimits the table for pasting in
excel. I have no idea how this works, but I wonder if there is some
shell command to utilize it.
I'm not touching that one however...
cheers,
Dan
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/