I am using a panel dataset with 217 countries for the years 1960-2019 for LPM/OLS regressions and binary logistic regressions with different sets of fixed effects.
Here is a small part of the dataset, including two countries and the relevant variables:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int(countryid year) byte SBC double(Inflation GDPgrowth ChangeUSRealIntRate) 1 1960 . . . . 1 1961 . . . . 1 1962 . . . .0345769246143519 1 1963 . . . .0496171384760478 1 1964 . . . -.1254008917344795 1 1965 . . . -.1306907629162991 1 1966 . . . .0325449453918016 1 1967 . . . -.0917912370544413 1 1968 . . . -.2253801399357135 1 1969 . . . .5299941825514756 1 1970 . . . -.2003848457250564 1 1971 . . . -.726961532950238 1 1972 . . . .4249851223705243 1 1973 . . . 1.716055335188069 1 1974 . . . -.3148327387422695 1 1975 . . . -1.776119281567968 1 1976 . . . -1.988656833588598 1 1977 . . . -.5460742175149453 1 1978 . . . 2.286357257204847 1 1979 . . . 1.134774719419512 1 1980 . . . .4168818365442992 1 1981 . . . .5034886818586575 1 1982 . . . -.0485410100969407 1 1983 . . . -.1906745247712417 1 1984 . . . .2301088321062921 1 1985 . . . -.1938010128553367 1 1986 . . . -.056291599468308 1 1987 . . . -.097080089062447 1 1988 . . . -.0003930197260594 1 1989 . . . .1968257597354104 1 1990 . . . -.097291975181809 1 1991 . . . -.1861654826557452 1 1992 . . . -.2097738552733388 1 1993 . . . -.0869027881466459 1 1994 . . . .3811068609621309 1 1995 . . . .346179966376311 1 1996 . . . -.0409551303959621 1 1997 . . . .0441806987577207 1 1998 . . . .0825005685960598 1 1999 . . . -.0966757710297634 1 2000 . . . .060043545017036 1 2001 . . . -.324052273146623 1 2002 . . . -.3418562352466881 1 2003 . 11.65523822034014 8.832277803702311 -.269606196854086 1 2004 . 11.2714320716706 1.41411798021916 -.2785449718897963 1 2005 . 10.91277353876418 11.22971483885948 .8580190286419143 1 2006 . 7.199751292862743 5.357403247546017 .6054595279480244 1 2007 . 22.52775620938839 13.82631953905948 .0912907179483942 1 2008 . 2.096288747620846 3.924983822845235 -.4098847846487074 1 2009 . -2.163404437667154 21.390528405312 -.1990592225672045 1 2010 . 3.814630325793573 14.36244145968155 -.1652978818302043 1 2011 . 16.59334672149497 .4263547928565714 -.4480913960441651 1 2012 . 7.301756477207434 12.75228708257883 .1492474047383388 1 2013 . 4.822785476102823 5.600744661319041 .1241054779015494 1 2014 . .566944539835859 2.724543364950279 -.0928384344168139 1 2015 . 2.447563007618058 1.451314654580045 .626148874541377 1 2016 . 5.102712887975841 2.260314204546404 .1035781921004473 1 2017 . 1.947722642301613 2.665292046368336 -.0991041456883716 1 2018 . .6177562357460005 1.840088543305725 .153549569336215 1 2019 . 2.239099328971307 2.901228964138468 .3992179177431745 2 1960 0 . . . 2 1961 0 . . . 2 1962 0 . . .0345769246143519 2 1963 0 . . .0496171384760478 2 1964 0 . . -.1254008917344795 2 1965 0 . . -.1306907629162991 2 1966 0 . . .0325449453918016 2 1967 0 . . -.0917912370544413 2 1968 0 . . -.2253801399357135 2 1969 0 . . .5299941825514756 2 1970 0 . . -.2003848457250564 2 1971 0 . . -.726961532950238 2 1972 0 . . .4249851223705243 2 1973 0 . . 1.716055335188069 2 1974 0 . . -.3148327387422695 2 1975 0 . . -1.776119281567968 2 1976 0 . . -1.988656833588598 2 1977 0 . . -.5460742175149453 2 1978 0 . . 2.286357257204847 2 1979 0 . . 1.134774719419512 2 1980 0 . . .4168818365442992 2 1981 0 -2.139571985927915 5.745635292006796 .5034886818586575 2 1982 0 -.0177190999887955 2.948596801568698 -.0485410100969407 2 1983 0 -.0167551715144612 1.104938261827002 -.1906745247712417 2 1984 0 -.0283602569954127 -1.251596644698552 .2301088321062921 2 1985 0 .3512223473216096 1.780643959772689 -.1938010128553367 2 1986 0 -2.417300428567174 5.63724317825185 -.056291599468308 2 1987 0 -.0003060928344496 -.7878426550129376 -.097080089062447 2 1988 0 -.0005785801257332 -1.420039654822475 -.0003930197260594 2 1989 0 .0036791614321601 9.83654897047623 .1968257597354104 2 1990 0 -.4313688130989135 -9.575640169486448 -.097291975181809 2 1991 0 35.51424695783908 -28.00214165604598 -.1861654826557452 2 1992 0 232.9846588718685 -7.187110916369505 -.2097738552733388 2 1993 0 125.6508142004235 9.559411694347531 -.0869027881466459 2 1994 1 35.84247521566806 8.302866591128605 .3811068609621309 2 1995 0 9.970662680224947 13.3223333200803 .346179966376311 2 1996 0 38.17211191224118 9.099999443602314 -.0409551303959621 2 1997 0 11.23968181678477 -10.91998408510352 .0441806987577207 2 1998 0 6.730245155560581 8.83008770869769 .0825005685960598 2 1999 0 2.103478599035128 12.88989673318892 -.0966757710297634 end
Code:
regress SBC l1.log_CredittoGDP l1.GDPgrowth l1.Inflation l1.ChangeUSRealIntRate, robust xtlogit SBC l1.log_CredittoGDP l1.GDPgrowth l1.Inflation l1.ChangeUSRealIntRate, fe
Code:
qui tab countryid if e(sample) di r(r)
In the simplest form, I use the command:
Code:
outreg2 using main_estimation_results, replace excel dec(4) outreg2 using main_estimation_results, append excel dec(4)
Code:
outreg2 using main_estimation_results, ctitle(OLS) keep(l1.log_CredittoGDP l1.Inflation l1.ChangeUSRealIntRate) addstat("F-Stat", e(F), "Prob > F", e(p), "Degrees of Freedom", e(df_r)) addtext(Fixed effects, None) replace excel dec(4) outreg2 using main_estimation_results, ctitle(Logit) keep(l1.log_CredittoGDP l1.Inflation l1.ChangeUSRealIntRate) addstat("F-Stat", e(F), "Prob > F", e(p), "Degrees of Freedom", e(df_r)) addtext(Fixed effects, Country) append excel dec(4)
Until now, I edited the tables manually in Excel after the export. For the sake of transparency, I would like format them correctly in Stata without subsequent manual edits.
I also have a number of other questions regarding the outreg2 command but as this is my first post in the forum, I was not quite sure whether each should go in a separate post.
Many thanks in advance!
0 Response to How to add the groups used in a regression to outreg2 export table?
Post a Comment