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 Rsquared 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/ 
No ideas?

 On Thu, 12/8/10, amarradia wrote:
> No ideas? You can contact the author of outreg2 directly, he is no long present on this list.  Maarten  Maarten L. Buis Institut fuer Soziologie Universitaet Tuebingen Wilhelmstrasse 36 72074 Tuebingen Germany http://www.maartenbuis.nl  * * 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/ 
In reply to this post by amarradia
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: [hidden email] [mailto:[hidden email]] On Behalf Of Amar Radia Sent: Tuesday, August 10, 2010 3:59 AM To: [hidden email] 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 Rsquared 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/ 
Thanks for this.
Roy Wada suggested he following code: 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 ct(`"`: var label `var''"') } He said the option will be included in future versions of outreg. 
Dear all:
I am writing some code using the file write to create some tables I'd like to use in LaTeX with some specific format. My problem is that I am first saving some means and standard deviations from my data to different scalars, which I then call within the file write command, but I cannot get the right format for these numbers. In particular, I want to report means normally, and standard deviations in parentheses. So far, the only thing I've been able to do is to get my standard deviations to look like this in the table: ( X.XX) that is, with one space after the "(". Would anyone know how to get rid of this? If you have some better solution to write a table like this, please let me know! Thank you very much!!Adrian Here is what I do: local varlist "age tenure"foreach var of local varlist{qui su `var' if sample == 1sca `var'_m1 = r(mean) sca `var'_v1 = r(sd)qui su `var' if sample == 2sca `var'_m2 = r(mean) sca `var'_v2 = r(sd)qui su `var' if !femalesca `var'_m3 = r(mean)sca `var'_v3 = r(sd)qui su `var' if femalesca `var'_m4 = r(mean)sca `var'_v4 = r(sd)} file open table1 using table1.tex, write replacefile write table1 "\begin{table}[htbp]\centering" _n ///"\begin{tabular}{lcccccccc}" _n ///"\hline \\" _n ///" & & Full & & Working & & & & \\" _n ///" & & Sample & & Sample & & Males & & Females \\" _n ///"\hline" _n ///"\textit{Worker characteristics} & & & & & & & & \\" _n ///"\quad Age (years) & & " %9.2f (age_m1) " & & " %9.2f (age_m2) " & & " %9.2f (age_m3) " & & " %9.2f (age_m4) " \\" _n ///" & & (" %9.2f (age_v1) ") & & (" %9.2f (age_v2) ") & & (" %9.2f (age_v3) ") & & (" %9.2f (age_v4) ") \\" _n ///"\quad Tenure (years) & & " %9.2f (tenure_m1) " & & " %9.2f (tenure_m2) " & & " %9.2f (tenure_m3) " & & " %9.2f (tenure_m4) " \\" _n ///" & & (" %9.2f (tenure_v1) ") & & (" %9.2f (tenure_v2) ") & & (" %9.2f (tenure_v3) ") & & (" %9.2f (tenure_v4) ") \\" _n ///"\end{tabular}" _n ///"\end{table}" _n /// file close table1 * * 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/ 
In reply to this post by Sarah Elizabeth Edgington
Thanks for your suggestion Sarah.
That works well using the ctitle option as you suggested, but I cannot get it to display both the variable name and label as I wish using cctop. If I just replace ctitle with cctop in the code it says something like "option cctop not allowed". Any ideas? Thanks 
Powered by Nabble  Edit this page 