Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: Table Command to Matrix or CSV


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: Table Command to Matrix or CSV
Date   Sun, 6 Feb 2005 22:30:06 -0000

You're ignoring the answers you have already received. 
With a twoway structure and multiple statistics, 
and indeed in any case, the output of -table- does 
not include a matrix as canned output. Therefore you 
would need to arrange some other way to collect whatever
it is you want and provide LaTeX annotation. 

Nick 
n.j.cox@durham.ac.uk 

Tristan Zajonc
 
> Is there a fast way to get the results of a twoway table with multiple
> statistics into a matrix format so I can access all the results
> programmaticly.  I'm hoping to create a way to produce a latex table
> from the table command.  Suggestions?
> 
> I assume there is nothing like this already made (I'm aware of
> labtabstat outtable etc).  Ideally it would produce a latex file with
> rows and columns plus multiple lines within each cell for each
> statistic.
 
Daniel Egan 

> > > > 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...
> > 

*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index