Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: export table of summary statistics to excel


From   Eric Booth <[email protected]>
To   "<[email protected]>" <[email protected]>
Subject   Re: st: export table of summary statistics to excel
Date   Fri, 13 May 2011 12:45:23 +0000

<>
Denise:  Not sure what is meant by a "horrible format".  You could always manipulate and edit the cell locations & contents of the -table- elements before outsheeting it from your Stata dataset, but I'd use -tabout- or -logout- in your case.
 -tabout- (this is from SSC) can create the table you describe (in terms of formatting), except that it doesnt accept pweights as far as I can tell.  Another option is using -logout- (also from SSC) to get your -table- into excel -- I have no idea if this is closer to formatting that you find acceptable, but it does look closer to the Results window output.

*********************!
sysuse auto, clear
g wei = runiform()*1
foreach prog in tabout logout {
cap which `prog'
if _rc ssc install `prog', replace
}

table rep78 for [pweight=wei], c(mean price) row col

tabout rep78 for using "test.xls", ///
  replace sum c(mean price N price) ptotal(all)
*note, you'll need to svyset to use weights w/tabout -- 
***it doesnt accept pweights

logout, save(test2) excel fix replace: table rep78 for ///
 [pweight=wei], c(mean price) row col stubwidth(25)
*********************!

- Eric
__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]

On May 13, 2011, at 4:48 AM, Denise Sengül wrote:

> Dear all,
> 
> I am searching to export tables of the following form
> 
> table var1 var2 [pweight=x], c(mean var3) row col 
> 
> I tried out the replace option of the table command and then exported the 
> new dataset with outsheet. 
> However, the exported table was in a horrible format in excel. This is not 
> due to the separation value but just to the arrangement of the table 
> entries. They are rather listed one below the other. I just want exactly 
> the same matrix format shown in the stata table before but I haven't found 
> any solution for this yet.
> Neither tabout nor tabstat nor anything else has worked. 
> 
> I'd be extremely grateful for any help.
> 
> Best,
> Denise Sengül
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/




*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index