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: "Best" command to output regression results


From   Eric Booth <[email protected]>
To   "<[email protected]>" <[email protected]>
Subject   Re: st: "Best" command to output regression results
Date   Wed, 3 Nov 2010 18:56:54 +0000

<>

Fred - 

You can do this from -estout- (from SSC) without the copy/pasting, concatenating, etc.  

Here's an example that will produce & open tables in Word and Excel (in Word, you'll still need to use the 'text to columns' function, unless you set up some kind of mail merge as Austin has mentioned).  Also, you probably will want to play with the CI formatting in the cells() option -- I'm not familiar with the Excel formulas that you describe. 
 If you're creating many tables, there shouldn't be any need to do this much clicking, formatting, and pasting as much of it should be able to be automated by one of the various Stata user packages designed for this purpose.    -outreg2- can probably do most, if not all, of what you describe as well.


*****************!
clear
sysuse auto, clear
estimates clear
**

foreach ext in xls doc  {
foreach iv in mpg price headroom {

logit for rep78 length turn `iv', or
est store Model_`iv'
}

estout * using "test.`ext'", replace ///
   cells("b(star fmt(3)) ci(par([  ]--[  ]) fmt(2))   p(fmt(2))" ) ///
    stats(r2_p chi2 bic N)  collabels("OR" "CI" "P>z")  
	
/*  Note: remove the quotes in the cells()  
    option above to stack the stats vertically  
*/  


//open tables in Windows or Mac OSX//
if "`c(os)'" == "MacOSX" local i open
if "`c(os)'" == "Windows" local i start
!`i' "test.`ext'"
}
*****************!

- Eric

__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]
Office: +979.845.6754
Fax: +979.845.0249
http://ppri.tamu.edu


On Nov 3, 2010, at 11:35 AM, Fred Wolfe wrote:

> What's best depends on what you want to do over and over again.
> 
> In general, I am usually satisfied with the regression output from
> Stata. From a log file or even from a screen copy, I move all of the
> results to a text editor. With a few key strokes I extract just the
> regression results (this usually requires a little programming or
> manipulation in the text editor). Then I paste the output into Excel,
> use "Text to Columns" and an Excel formula to move the CIs together
> and to properly format the number of Decimal places. This is then
> pasted into MS word.
> 
> It takes a little while to figure out how to do this. But once set up
> is very fast.  It's suitable for multiple tables. I also use the
> method for tables of descriptive statistics. It's possible to process
> many tables at once, so it is very fast. Like others, I would like
> Stata to be able to make better tables and output, but until that
> happens this method works best for me. I am sure other methods work
> best for others.
> 
> Fred
> 
> PS. Here are my notes:
> 
> Get Coefficients (HR, OR, etc.), 95% CI, and p value for Word tables
> from regression output
>    Paste 7 column regression output into Excel
>    Use text to column in data menu. Remove se and t, leaving 5 columns
>    Do not format cells
>    Insert 2 columns before P>z
>    Insert P>z into Column D
>    Place cursor in C2, and paste in one of the below functions,
> depending on decimal points
>    =CONCATENATE(FIXED(B1,1)," (",FIXED(F1,1),", ",FIXED(G1,1),")")
>    =CONCATENATE(FIXED(B1,2)," (",FIXED(F1,2),", ",FIXED(G1,2),")")
>    =CONCATENATE(FIXED(B1,3)," (",FIXED(F1,3),", ",FIXED(G1,3),")")
>    =CONCATENATE(FIXED(B2,1)," (",FIXED(F2,1),", ",FIXED(G1,1),")")
>    =CONCATENATE(FIXED(B2,2)," (",FIXED(F2,2),", ",FIXED(G1,2),")")
>    =CONCATENATE(FIXED(B2,13)," (",FIXED(F2,3),", ",FIXED(G1,3),")")
>    Expand function by dragging
>    Copy first 4 columns to Word, and delete column 2
> 
> 
> Fred
> 
> On Wed, Nov 3, 2010 at 11:07 AM, Weichle, Thomas <[email protected]> wrote:
>> 
>> Hi Statalisters,
>> Is there a best command to output regression results (coefficients,
>> confidence intervals)?  The -estimates table- command doesn't allow you
>> to output confidence intervals; it only allows you to output stars for
>> significance levels.  I came across the -estout- command and am trying
>> to understand its usage.  If I have saved the logistic regression
>> results using -estimates store model1-, can someone provide me an
>> example to output the ORs and confidence intervals (both rounded to 2
>> decimal places) in the log file?
>> 
>> Eventually, I'd like to take the estimates and put them in a Word
>> document.  Does anyone have a suggestion to do so without having to copy
>> and paste each estimate into the Word document?
>> 
>> Tom Weichle
>> Math Statistician
>> Center for Management of Complex Chronic Care (CMC3)
>> Hines VA Hospital, Bldg 1, C202
>> 708-202-8387 ext. 24261
>> [email protected]
>> 
>> *
>> *   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/
> 
> 
> 
> --
> Fred Wolfe
> National Data Bank for Rheumatic Diseases
> Wichita, Kansas
> NDB Office  +1 316 263 2125 Ext 0
> Research Office +1 316 686 9195
> [email protected]
> 
> *
> *   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