help ttable2

Title

ttable2 -- Mean Comparison for a lot of variables between two groups with formatted table output

Syntax

ttable2 varlist [if] [in], by(varlist:groupvar) format:(%fmt)

varlist is a list of numerical variables to be tested.

For each of those variables, we need to perform a standard t-test to compare it's mean difference
between two groups specified by option by(varlist:groupvar).
groupvar must be a dichotomous variable for the sample
specified by [if] and [in]. groupvar maybe either numerical or string, provided that it only takes two different values for the sample.

format(%fmt)
specify the display format for group means and their difference; default format is %8.3f.

Examples

The auto data

. sysuse auto,clear

. ttable2 price wei len mpg, by(foreign)

. ttable2 price wei len mpg, by(foreign) f(%6.2f)

. tab rep78

. ttable2 price wei len mpg if rep78==3|rep78==4, by(rep78)

Save in Excel or Word

you can use the user-written logout command to export the results into Excel or Word:

. logout, save(Tab2_corr) excel replace: ttable2 price wei len mpg, by(foreign)

Authors

Xuan Zhang

Zhongnan University of Economics and Law

Wuhan, China

zhangx@znufe.edu.cn

Chuntao Li

Zhongnan University of Economics and Law

Wuhan, China

chtl@znufe.edu.cn

and updated by:

Yujun,Lian (Arlion) Department of Finance, Lingnan College, Sun Yat-Sen University.

E-mail: arlionn@163.com.

Blog: http://blog.cnfol.com/arlion.

Homepage: http://www.lingnan.net/intranet/teachinfo/dispuser.asp?name=lianyj.