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 17:47:30 +0000

<>

In an earlier post, Michael Morrison also wrote:
>>>> did a -hsearch administrator- and received a few hits but nothing specific to see if I was on the right path.

Permissions or privileges are managed by the OS, not Stata.  If you cannot write to a directory, you need to check your permissions, group policies, etc. in your OS to make sure you can write files to that location.  A quick google search of "cannot write to c:\ " turns up lots of potential reasons for this problem that have nothing to do with Stata (permissions/policies, too many folders in your C:\, etc.).  
If you find that other programs (like notepad or Excel) can all write files to C:\ and your permissions and group policies are set up correctly, then try writing to C:\ with official Stata commands like -outsheet- or -save-.  Finally, if all this works except for -tabout-, -set trace on-, run your -tabout- code, and see what causes it to stop.

- 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


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