Put anything anywhere in Excel without sweat

putexcel has recently become a very good friend. For those who (or working with people who) find comfort in working with tables in Excel after data processing or estimation in Stata (yes, there are others who don’t find comfort in this.) and already into Stata 13, learning putexcel could be very helpful (put an end to copy-pasting!). A number of user-written commands, such as outreg [1], outreg2, tabout, are also already available for similar purposes. What puts putexcel apart is its ‘user-friendliness’ and flexibility. You can put anything anywhere in Excel without sweat.

Continue reading

Writing a formatted regression output using -outreg-

I used to copy-paste regression results into Windows Excel spreadsheet, not only to do some formatting, but also to add asterisks to indicate significance, write notes, etc., until I learned about -outreg- (thanks to Utsav). -outreg-, written by J.L. Gallup, writes formatted regression output and saves them into a specified spreadsheet. The command is especially helpful when you want to compare a number of regression results, as we always do, to check for the robustness of our results. The table below shows an example of an -outreg- result.

How do you create this table?

reg y_var x_vars1, [robust]   /* results displayed in column (1) /
outreg x_vars using filename, [options] replace /
the replace option replaces the file filename */

reg y_var x_vars2, [robust]   /* results displayed in column (2) /
outreg x_vars using filename, [options] append /
the append option appends the result of the regression to filename /
reg y_var x_vars8, [robust]   /
results displayed in column (8) */
outreg x_vars using, [options] append

The options specified to create the table above are:

/*specifies the number of decimal places for the reported estimates */

/* specifies that R-squared will not be reported. I wanted to show R-squared, but not in its default position. I used the addstat() option to do this. */

/* specifies that * for significance levels are appended to regression coefficients */

/* specifies 3 * for 1%, 2 * for 5%, and 1 * for 10% significance levels */

/* specifies that standard errors wil be displayed, not t-statistics */

/* specifies that variable names will be reported, not variable labels */

/* specifies that [] are used, not () for t-statistics or standard errors. This is specifically helpful because, by default, Excel reads numbers in () as negative numbers. */

addstat(“text” , # [, “text”, # …])
/*specifies other statistics you want to add in the table. In this case, I added the following:
“Degrees of freedom”, e(df_r)
“R-squared”, e(r2)
“Adjusted R-squared”, e(r2_a)

More options are available for -outreg-, type “help outreg”. But, first, you need to install -outreg- by typing:

net install sg97_3.pkg

Note: The results shown in the table above are from some of the tests we (with Jesus Felipe and Utsav Kumar) did for the paper “Using Capabilities to Project Growth, 2010-2030.”