*! version 1.1.0 04sept1999 Jeroen Weesie/ICS (STB-53: sg127) program define estsumm version 6.0 if "`e(cmd)'" == "" { error 301 } syntax, [ eq ] tempname b mat `b' = e(b) local vnames : colnames `b' local vnames : subinstr local vnames "_cons" "", all word * width of table including variable labels tokenize "`vnames' `e(depvar)'" local len 23 local i 1 while "``i''" ~= "" { local vlab : var label ``i'' local len = max(`len', length(`"`vlab'"')) local i = `i'+1 } local lsize : set display linesize local vlwidth = min(`lsize' - 57,`len') local llength = 56 + `vlwidth' Header `llength' if "`eq'" ~= "" { if "`e(depvar)'" ~= "" { di in ye "depvar |" tokenize `e(depvar)' while "`1'" ~= "" { Stats `1' `vlwidth' mac shift } Line `llength' } local eqnames : coleq `b' } else { DropDup vnames : "`e(depvar)' `vnames'" } local n : word count `vnames' local eqold "_" local i 1 while `i' <= `n' { local vn : word `i' of `vnames' local eqnew : word `i' of `eqnames' if "`eqnew'" ~= "`eqold'" & "`eq'" ~= "" { if "`eqold'" ~= "_" { Line `llength' } di in ye %-8s "`eqnew'" _col(10) in gr "|" local eqold `eqnew' } Stats `vn' `vlwidth' local i = `i'+1 } if "`e(wtype)'" ~= "" { Line `llength' capt drop __weight qui gen __weight `e(wexp)' if e(sample) label var __weight `"weighted by `e(wexp)'"' Stats __weight `vlwidth' drop __weight } end program define Line args llength local ll = `llength'-10 di in gr "---------+" _dup(`ll') "-" end program define Stats args vn vlwidth qui summ `vn' if e(sample) local vlab : var label `vn' local vl : piece 1 `vlwidth' of `"`vlab'"' #del ; di in gr %8s "`vn'" _col(10) "|" in ye _col(12) %9.0g r(mean) _col(23) %9.0g sqrt(r(Var)) _col(34) %9.0g r(min) _col(45) %9.0g r(max) _col(56) in gr `"`vl'"' ; #del cr * rest of variable label local j 2 local vl : piece `j' `vlwidth' of `"`vlab'"' while `"`vl'"' ~= "" { di in gr _col(10) "|" _col(56) `"`vl'"' local j = `j'+1 local vl : piece `j' `vlwidth' of `"`vlab'"' } end program define Header args llength tempvar last N touse local ll = `llength' - 30 qui gen `touse' = e(sample) qui count if `touse' di in gr "Estimation sample " in ye "`e(cmd)'" _col(`ll') /* */ in gr "Number of obs =" in ye %9.0f r(N) _n if "`e(clustvar)'" ~= "" { sort `touse' `e(clustvar)' qui by `touse' `e(clustvar)' : gen `last' = _N==_n if `touse' qui by `touse' `e(clustvar)' : gen `N' = _N if `touse' qui count if `last'==1 di _col(`ll') in gr "Number of clusters =" in ye %9.0f r(N) qui summ `N' if `last'==1 di _col(`ll') in gr "Obs per cluster: min =" in ye %9.0f r(min) di _col(`ll') in gr " avg =" in ye %9.1f r(mean) di _col(`ll') in gr " max =" in ye %9.0f r(max) di } di in gr "Variable | Mean Std. Dev. Min Max Label" Line `llength' end /* DropDup newlist : list drops all duplicate tokens from list -- copied from hausman.ado */ program define DropDup args newlist /* name of macro to store new list */ colon /* ":" */ list /* list with possible duplicates */ gettoken token list : list while "`token'" != "" { local fixlist `fixlist' `token' local list : subinstr local list "`token'" "", word all gettoken token list : list } c_local `newlist' `fixlist' end exit