Statalist


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

Re: st: RE: Exporting xtsum output?


From   Dorothy Bridges <dbstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Exporting xtsum output?
Date   Tue, 29 Sep 2009 09:41:26 -0400

I see, thank you very much.  I will give it a try and send another email.

On Tue, Sep 29, 2009 at 9:27 AM, Martin Weiss <martin.weiss1@gmx.de> wrote:
>
> <>
>
>
> -postfile- (http://www.stata-journal.com/article.html?article=pr0036, that
> is how I learned about its very existence) is a command that opens a virtual
> dataset to which you can "post", i.e. dump, some information. In your case,
> I cycle through the array of results left behind by -xtsum- and put them
> into the rows of the -postfile-. There may be other ways to do this, but
> this is a viable one.
>
> So you enter into the -foreach- line your variables which should be
> -xtsum-med and let -postfile- do its magic. Afterwards, the file with the
> dumped results opens automatically (line -use-) and is translated to -xml-,
> to make it amenable to editing in spreadsheet editors. The last line then
> hopefully opens the spreadsheet editor on your system, if not, open the
> -xml- file manually. At least the latest versions of popular spreadsheet
> editors understand -xml-.
>
> Let me know whether this worked for you. In order to prevent Stata`s
> complaints, we must -erase- any file "info.dta" before we can proceed. The
> -capture- in front of -erase- pretty much says: If there is such a file in
> the current working directory, -erase- it, otherwise move to the next line
> and do not complain!
>
>
>
> HTH
> Martin
>
>
> -----Ursprüngliche Nachricht-----
> Von: Dorothy Bridges [mailto:dbstata@gmail.com]
> Gesendet: Dienstag, 29. September 2009 15:20
> An: martin.weiss1@gmx.de
> Betreff: Re: st: RE: Exporting xtsum output?
>
> Martin,
>
> Thank you so much for your response.  I know we're not supposed to
> reply privately, but I didn't want to clog the listserve with
> questions that likely won't be of use to other readers.  I'm not
> familiar with "capture erase" or "postfile;" I tried to translate your
> code using Stata help, but couldn't quite get there.  Would you mind
> explaining briefly the idea behind your approach?
>
> Thank you,
> Dorothy
>
> On Mon, Sep 28, 2009 at 3:26 PM, Martin Weiss <martin.weiss1@gmx.de> wrote:
>>
>> <>
>>
>> -xtsum- does not return a matrix of results, but r() returns for the last
>> variable it evaluated. So you have to be creative here...
>>
>>
>>
>> **************
>> webuse nlswork, clear
>>
>> capture erase info.dta
>> tempname hdle
>>
>> postfile `hdle' str32(var category)/*
>> */  mean sd min max obs using info
>>
>> foreach var of varlist /*
>> */ hours race nev_mar grade{
>>        qui xtsum  `var'
>>        post `hdle' ("`var'") ("overall") /*
>>                */ (`r(mean)') (r(sd)) (r(min)) /*
>>                */ (r(max)) (r(N))
>>        post `hdle' ("`var'") ("between") /*
>>                */ (.) (r(sd_b)) (r(min_b)) /*
>>                */ (r(max_b)) (r(n))
>>        post `hdle' ("`var'") ("within") /*
>>                */ (.) (r(sd_w)) (r(min_w)) /*
>>                */ (r(max_w)) (r(Tbar))
>> }
>>
>> postclose `hdle'
>>
>> use info, clear
>> l, abbrev(12) noobs sepby(var)
>>
>> //to spreadsheet!
>> xmlsave "myxmlfile", doctype(excel) replace
>> !start myxmlfile.xml
>> **************
>>
>>
>> HTH
>> Martin
>>
>>
>> -----Original Message-----
>> From: owner-statalist@hsphsun2.harvard.edu
>> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Dorothy Bridges
>> Sent: Montag, 28. September 2009 21:02
>> To: statalist@hsphsun2.harvard.edu
>> Subject: st: Exporting xtsum output?
>>
>> Dear Statalist:
>>
>> Is there an equivalent of outreg for xtsum?  "Copy table" isn't quite
>> working to get my panel summary statistics into Excel.
>>
>> Thanks,
>> Dorothy
>> *
>> *   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/
>>
>
>
> *
> *   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index