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   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: st: "Best" command to output regression results
Date   Wed, 3 Nov 2010 19:14:28 +0000

Exactly! This is a standard trade-off and it bites experienced users almost as much as new users, and no one has an easy answer. 

Fred worked out how to do what he wanted and now can "routinize" it (a word that is ugly but accurate here): meaning, he can repeat his procedure with much less stress than when he first worked it out, and indeed vary it a bit as needed. 

There are undoubtedly other ways to do it, but sometimes with a complicated command it can take you as long to understand the complicated command's way of thinking about your problem as doing it from scratch using basic tools. 

It's not easy for programmers either. You can think you've designed a Swiss Army knife, with lots of useful extra bits, but to users it might look just like a Heath Robinson design. 

U.S. readers: substitute "Rube Goldberg". 
Other readers: sorry, I don't know other equivalents. 

Nick 
[email protected] 

Eric Booth

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'"
}
*****************!

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

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