Tables with esttab

The group of esttab and estout commands is a handy option to export nice-looking tables of regression results, but also summary statistics.
See below for exporting the results after regress, summarize or ttest.
Some general notes:

  • If you are using it for the first time, make sure to first install the respective package:
    ssc install estout
  • The first step is to run the regression commands and to save your results temporarily. This is easily done with the prefix eststo model_name
  • You can display and replay all saved regressions using estimates dir
  • To delete your stored results, type estimates clear

Tables with esttab after regress

	
*Esttab/estout for regression tables
eststo a1: reg price weight if foreign == 0   		//Prefix "eststo equation_name:" stores the estimation results for later use. 
eststo a2: reg price weight if foreign == 1	
esttab a1 a2	
esttab a1 a2, se star(* 0.1 ** 0.05 *** 0.01) 		//Creates a nice looking table with standard errors in parantheses below the coefficients and starlevels as defined in the option.
esttab a1 a2 using "example_table.rtf", se star(* 0.1 ** 0.05 *** 0.01) replace //Exports the table to a word file.			
			

Tables with esttab after summarize

*Esttab/estout for regression tables
eststo a1: reg price weight if foreign == 0   		//Prefix "eststo equation_name:" stores the estimation results for later use. 
eststo a2: reg price weight if foreign == 1	
esttab a1 a2	
esttab a1 a2, se star(* 0.1 ** 0.05 *** 0.01) 		//Creates a nice looking table with standard errors in parantheses below the coefficients and starlevels as defined in the option.
esttab a1 a2 using "example_table.rtf", se star(* 0.1 ** 0.05 *** 0.01) replace //Exports the table to a word file.			
			

Tables with esttab after ttest

*Esttab/estout for t-tests (N1 mean1 N2 mean2 diff p-value)
eststo t: estpost ttest price weight length, by(foreign)
esttab t using "example_ttest.rtf", ///  		
cells("N_1 mu_1(fmt(2)) N_2 mu_2(fmt(2)) b(fmt(2)) p(fmt(4))") noobs label replace		
//Using esttab with t-tests is possible but requires some editing afterwards.