Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: RE: Getting outreg2 to output variable labels instead of names?


From   "Sarah Edgington" <sedging@ucla.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Getting outreg2 to output variable labels instead of names?
Date   Thu, 12 Aug 2010 10:32:09 -0700

The problem is that the label option on outreg2 uses the variable labels for
your explanatory variables, not the dependent variable.   
To change the column heading for the dependent variable you'll need to use
the ctitle option.  You can pull the variable label into a local macro and
do it that way.  Something like this:

local z "q114_8	q117_b q117_g "
foreach k of local z{
local lab : var label `k'
reg `k' t panel interaction, robust
outreg2 using "D:\...\regressions outreg", label excel ctitle(`lab')
}

Note that if you want the label as well as rather than instead of you could
use the cctop option instead.

-Sarah

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Amar Radia
Sent: Tuesday, August 10, 2010 3:59 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: Getting outreg2 to output variable labels instead of names?

Hi there,

I'm using Stata 10.1 and trying to use outreg2 to create an excel file with
the output of all of my regression outputs. I'm running the same regression
with a large number of different dependent variables.
However, the variable names are not meaningful, but the labels are, and I
want to output these instead of/as well as the names.

My code is as follows:

local z "q114_8	q117_b q117_g "
foreach k of local z{
reg `k' t panel interaction, robust
outreg2 using "D:\...\regressions outreg", label excel }

q114_8, q117_b and q117_g are my variables (there are actually a lot more
but ive just put a few here)

However my output in excel appears like this, with the variable names
instead of labels:
  (1) (2) (3) VARIABLES q114_8 q117_b q117_g         t 0.00284 -0.0441
-0.0543* (0.0200) (0.0299) (0.0311) panel 0.0520* 54.68*** 52.89***
(0.0282) (1.518) (1.533) interaction -0.000142 -4.547** -5.049**
(0.0395) (2.128) (2.147) Constant 0.108*** 0.485*** 0.527*** (0.0148)
(0.0214) (0.0223) Observations 4,432 3,912 3,881 R-squared 0.001 0.348
0.332

Any suggestions?

Thanks in advance
*
*   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   |   Site index