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: Exporting tables to Excel


From   Eric Booth <[email protected]>
To   "<[email protected]>" <[email protected]>
Subject   Re: st: Exporting tables to Excel
Date   Fri, 4 Mar 2011 16:28:07 +0000

<>

  Once again, when you hit an error, send us the code you ran that created the error.
Assuming you are correct that no application has myexcelfile.txt (or.xls) open and your permissions are all correct, then another option is that you misspecified the path for 'using'.  
So you may have typed "C:\ado\folder11\myexcelfile.txt" and "folder11" doesn't exist (or you missed a space, etc.).  Usually when I get this same error from -tabout-, it's because the using path is wrong.
Try listing the other files in that path to make sure Stata can navigate there, type: 

 ls  "<insert your file path here>" 
so for my example above, type
ls    "C:\ado\folder11\myexcelfile.txt"

(and report what happens)

- Eric

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


On Mar 4, 2011, at 10:10 AM, Michael Morrison wrote:

> I just tried the generous example provided by Eric but I got this error message:
> 
> "File myexcelfile.txt
> is already open inside another application.
> Please close it before running tabout."
> 
> The problem is that there's no other program using myexcelfile.txt
> 
> I suspect this has something to do with administrator privileges, but I'm not sure. I did a -hsearch administrator- and received a few hits but nothing specific to see if I was on the right path.
> 
> Any help would be appreciated.
> 
> Mike
> 
> 
> On 3/4/2011 8:28 AM, Eric Booth wrote:
>> <>
>> 
>> -tabout- (from SSC) will allow you to put many variables in the c() option and varlist.
>> Did you specify the 'sum' option as well? Also, keep in mind that the 'n' stat you specified should be 'N'.
>>  Let us know the -tabout- code you tried that isn't working.
>> 
>> This example exports an excel table (really just a text file that excel will open since I gave it a xls extension) with some summary stats (N, mean, median) for 3 variables by 5 other variables.
>> ***************!
>> sysuse auto, clear
>> tabout for rep78 trunk  using "myexcelfile.xls", sum replace   ///
>> c(mean mpg N mpg mean price N price median turn median headr N weight) ///
>> f(1c) ptotal(both)
>> ***************!
>> Take a look at this for some help with -tabout-:  http://fmwww.bc.edu/repec/bocode/t/tabout_tutorial.pdf
>> 
>> There are lots of other options out there besides -tabout- (though it's the one I most commonly use).   Try typing -findit export table-  into the command line to see some other user packages that have similar functionality.
>> 
>> - Eric
>> __
>> Eric A. Booth
>> Public Policy Research Institute
>> Texas A&M University
>> [email protected]
>> Office: +979.845.6754
>> 
>> On Mar 4, 2011, at 7:58 AM, Diana Iancu wrote:
>> 
>>   
>>> Dear all,
>>> 
>>> Is it possible to export complicated tables from Stata to Excel, for instance:
>>> table var1 var2, c(n var3 mean var3) ?
>>> I have tried tabout, but as far as I can see, it doesn't allow me to include more than one variable in c( ) or to table 3 variables.
>>> Your assistance will be highly appreciated.
>>> 
>>> Best regards,
>>> Diana Iancu
>>> 
>>> 
>>> 
>>> 
>>> *
>>> *   For searches and help try:



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