# Summary Statistics

**DO File:** Summary statistics

With almost every paper or project, you will want to analyze your summary statistics to get a general feel for your data. In many cases, you'll want to output the results into some printed format. Here is a way to get it into a TEX document without much trouble:

**. ssc install estout**

**. sysuse nlsw88, clear**

**. local vars age race married union hours wage**

**. estpost summarize `vars' **

**. esttab using summarystats.tex, cells("mean(fmt(2)) sd(fmt(2)) count(fmt(0))") noobs nonumber label title("Summary statistics") replace**

**. !texify -p -c -b --run-viewer summarystats.tex**

If you don't include the "nonumber" option, you can actually set up the estimates table to show multiple equations. This could be helpful if you have several subsamples or groups that you would like to compare.

**. local divide race /* divide is the var that determines the subgroups */ **

**. estimates drop _all **

**. estpost summarize `vars' **

**. est store A **

**. estpost summarize `vars' if `divide'==1**

**. est sto B **

**. estpost summarize `vars' if `divide'~=1**

**. est sto C**

**. esttab A B C using summarystats-groups.tex, cells("mean(fmt(2)) sd(fmt(2))") label title("Summary statistics") collabels("Mean" "S.D.") mtitle("Full" "Samp =1" "Samp ~=1") nonum replace **

**. !texify -p -c -b --run-viewer summarystats-groups.tex**

I am not sure how to get the mtitle labels to span two columns so it's multicolumn. If anybody has a quick fix, please tell me.

"The secret to success is to do the common things uncommonly well." ~ John D. Rockefeller