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: having regression tables appear on top of each other in excel, using estout


From   Hilde Karlsen <hildekarlsen79@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: having regression tables appear on top of each other in excel, using estout
Date   Fri, 1 Jul 2011 10:46:42 +0200

Dear statalist,

I am using the -estout- command to produce regression tables in excel.
I am currently working on a number of linear regressions which I would
like to appear "on top" of each other  in excel (for each educational
group - e.g. nurses, social workers, enginers etc, in my analysis),
rather than beside each other.

That is, for each dependent variable I would like the table to look
like this in excel:

                                   Depvar1      Depvar2        Depvar3
                                   b  se(b)       b    se(b)        b   se(b)
Nurses
Constant
indepvar1
indepvar2
indepvar3
N
r2
Social workers
Constant
indepvar1
indepvar2
indepvar3
r2
Engineers
Constant
indepvar1
indepvar2
indepvar3
N
r2


.....and not like this (where _0 - _2 indicates the educational
groups, e.g. nurses, social workers and engineers respectively) :

                                  Depvar1_0      Depvar2_0
Depvar3_0      Depvar1_1      Depvar2_1        Depvar3_1
Depvar1_2      Depvar2_2        Depvar3_2
                                   b  se(b)       b    se(b)        b   se(b)
Constant
indepvar1
indepvar2
indepvar3
N
r2

Currently, my command looks like this and it produces the "wrong" type
of table (i.e. not the first one, but the latter):

capture est clear
foreach var of varlist Advance Help Pay Parttime  {
                               /*These are the dependent variables*/
forvalues y = 0(1)4 {

/*0-5 are the educational groups*/
		regress `var' sikkerutd kjonn alderomk_07 morhoyutd farhoyutd  if
storeutd ==`y'
		eststo `var'`y'
		estout using LB_indeg.csv, replace											
                                        ///
			prehead("Table 1: LB for educational groups (Sykepleier(0),
Fysikalsk(1), Allmennlærer(2), Sosialt arbeid(3), Ingeniør(4)")			///
			cells("b(fmt(%9.2f) star label(B)) 	se(fmt(%9.2f) label (SE(B)))")
								                                                        ///
			label varwidth(30) varlabels(_cons "Konstant" kjonn "mann"
alderomk_07 "Alder siste utdanningsår"
                       ///
                        morhoyutd "Mor høy utdanning" farhoyutd "Far
høy utdanning" sikkerutd "Motivasjon")
                                             ///
			order (_cons) ///
			stats(N r2, fmt(%9.2g)labels(N R2))
			}
}


My question is: how do I write this code so that it produces the first
type of table?

Any  help on this is highly appreciated.

Best regards, Hilde

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