📄 _tab.hlp
字号:
{pmore2}
{cmd:.}{it:obj}{cmd:.titlecolor result . . . . . .}
{phang}
10. Set the string color for each column.
{pmore}
{cmd:.strcolor} sets the color for strings in each individual column.
{cmd:.strcolor} requires an argument for each column.
The default string color is {opt text}, which already matches that of
{cmd:ereturn} {cmd:display}. To make the strings in the second column
{opt result}, type
{pmore2}
{cmd:.}{it:obj}{cmd:.strcolor . result . . . . .}
{phang}
11. Set the number color for each column.
{pmore}
{cmd:.numcolor} sets the color of numbers in each individual column.
{cmd:.numcolor} requires an argument for each column.
The default number color is {opt text}, which already matches that of
{cmd:ereturn} {cmd:display}. To make the numbers in the last two columns
{opt input}, type
{pmore2}
{cmd:.}{it:obj}{cmd:.numcolor . . . . . input input}
{phang}
12. Display the table elements, row by row.
{pmore}
{cmd:.sep} will display a horizontal line. It respects the vertical
separators specified in {cmd:.width}.
{pmore}
{cmd:.titles} displays the specified titles.
{cmd:.titles} requires an argument for each column.
To display titles that match those of {cmd:ereturn} {cmd:display}, type
{pmore2}
{cmd:.}{it:obj}{cmd:.titles "" "Coef." "Std. Err." "t" "P>|t|" "[95% Conf. Interval]" ""}
{pmore}
{cmd:.row} displays a row in the body of the table.
{cmd:.row} requires an argument for each column.
Strings are expected to be bound in double quotes (or compound double quotes).
Expressions with spaces are expected to be bound in parentheses.
{pmore}
To display the row for variable {cmd:mpg} from a regression fit, type
{phang2}
{cmd:.}{it:obj}{cmd:.row "mpg" _b[mpg] _se[mpg] (_b[mpg]/_se[mpg])}{break}
{cmd:2*ttail(e(df_r),abs(_b[mpg]/_se[mpg]))}{break}
{cmd:_b[mpg]-_se[mpg]*invttail(e(df_r),.025)}{break}
{cmd:_b[mpg]+_se[mpg]*invttail(e(df_r),.025)}
{title:Options for .new and .reset}
{phang}
{opt width(#)} specifies the default column width to be {it:#} characters
wide. Initially the default is 12 characters.
{phang}
{opt columns(#)} specifies the number of columns in the table. Initially the
default is 2 columns.
{phang}
{opt lmargin(#)} specifies the left margin, which is the number of spaces the
table is indented. The default left margin is 2 spaces.
{phang}
{opt tcolor(color)} specifies the default title color. Initially the default
is {opt text}.
{phang}
{opt ncolor(color)} specifies the default color for numbers. Initially the
default is {opt result}.
{phang}
{opt scolor(color)} specifies the default color for strings. Initially the
default is {opt text}.
{phang}
{opt lcolor(color)} specifies the default color of the separator lines.
Initially the default is {opt text}.
{phang}
{opt tfmt(sfmt)} specifies the default title format. Initially the
default is determined from the column width.
{phang}
{opt nfmt(nfmt)} specifies the default numeric format. Initially the
default is determined from the column width.
{phang}
{opt sfmt(sfmt)} specifies the default string format. Initially the
default is determined from the column width.
{phang}
{opt nocommas} indicates that commas are not be used in the default numeric
format. Initially, this is the default behavior.
{phang}
{opt commas} indicates that commas be used in the default numeric format.
{phang}
{opt ignore(item)} specifies that {it:item} be ignored if supplied to
{cmd:.row}. By default, only empty strings ({cmd:""}) are ignored by
{cmd:.row}.
{phang}
{opt separator(#)} specifies that a separator be automatically drawn between
every {it:#} rows. Initially there are no automatic row separators, which
is explicitly set by {cmd:separator(0)}.
{phang}
{opt clear(clear_options)} clears the specified table parameters.
{phang}
{opt clear} is a shortcut for {cmd:clear(all)}.
{title:Options for .width}
{phang}
{opt noreformat} prevents {cmd:.width} from resetting the column formats
for titles, strings, and numbers.
{title:Options for .sep}
{phang}
{opt top} causes the display of a horizontal line appropriate for the top of
the table.
{phang}
{opt middle} causes the display of a horizontal line appropriate for the
middle of the table. This is the default for {cmd:.sep}.
{phang}
{opt bottom} causes the display of a horizontal line appropriate for the
bottom of the table.
{title:A note about colors}
{pstd}
The color identifiers {opt text}, {opt result}, {opt error}, and {opt input}
have the following respective synonyms:
{opt g:reen}, {opt y:ellow}, {opt r:ed}, and {opt w:hite}.
{title:Examples}
{* BEGIN: _tab_hlp.smcl}{...}
{res}* _my_tab.ado
program _my_tab
syntax [, level(int `c(level)') ]
tempname mytab z t p ll ul
.`mytab' = ._tab.new, col(7) lmargin(0)
.`mytab'.width 13 |12 12 8 8 12 12
.`mytab'.titlefmt . . . %6s . %24s .
.`mytab'.pad . 2 1 0 2 3 3
.`mytab'.numfmt . %9.0g %9.0g %7.2f %5.3f %9.0g %9.0g
if "`e(df_r)'" != "" {c -(}
local stat t
scalar `z' = invttail(e(df_r),(100-`level')/200)
{c )-}
else {c -(}
local stat z
scalar `z' = invnorm((100+`level')/200)
{c )-}
local namelist : colname e(b)
local eqlist : coleq e(b)
local k : word count `namelist'
.`mytab'.sep, top
if `:word count `e(depvar)'' == 1 {c -(}
local depvar "`e(depvar)'"
{c )-}
.`mytab'.titles "`depvar'" /// 1
"Coef." /// 2
"Std. Err." /// 3
"`stat'" /// 4
"P>|`stat'|" /// 5
"[`level'% Conf. Interval]" "" // 6 7
forvalues i = 1/`k' {c -(}
local name : word `i' of `namelist'
local eq : word `i' of `eqlist'
if "`eq'" != "_" {c -(}
if "`eq'" != "`eq0'" {c -(}
.`mytab'.sep
local eq0 `"`eq'"'
.`mytab'.strcolor result . . . . . .
.`mytab'.strfmt %-12s . . . . . .
.`mytab'.row "`eq'" "" "" "" "" "" ""
.`mytab'.strcolor text . . . . . .
.`mytab'.strfmt %12s . . . . . .
{c )-}
local beq "[`eq']"
{c )-}
else if `i' == 1 {c -(}
local eq
.`mytab'.sep
{c )-}
scalar `t' = `beq'_b[`name']/`beq'_se[`name']
if "`e(df_r)'" != "" {c -(}
scalar `p' = 2*ttail(e(df_r),abs(`t'))
{c )-}
else scalar `p' = 2*norm(-abs(`t'))
scalar `ll' = `beq'_b[`name']-`beq'_se[`name']*`z'
scalar `ul' = `beq'_b[`name']+`beq'_se[`name']*`z'
.`mytab'.row "`name'" ///
`beq'_b[`name'] ///
`beq'_se[`name'] ///
`t' ///
`p' ///
`ll' `ul'
{c )-}
.`mytab'.sep, bottom
end
{txt}
{cmd}. sysuse auto, clear
{txt}(1978 Automobile Data)
{cmd}. regress mpg turn trunk displ, noheader
{txt}{hline 13}{c TT}{hline 64}
mpg {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval]
{hline 13}{char +}{hline 64}
turn {c |} {res}-.4971904 .165826 -3.00 0.004 -.82792 -.1664608
{txt} trunk {c |} {res} -.222583 .1353748 -1.64 0.105 -.4925796 .0474136
{txt}displacement {c |} {res}-.0196434 .0080013 -2.46 0.017 -.0356016 -.0036853
{txt} _cons {c |} {res} 47.94784 5.290301 9.06 0.000 37.39667 58.49902
{txt}{hline 13}{c BT}{hline 64}
{cmd}. _my_tab
{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text} mpg{col 14}{c |} Coef.{col 27} Std. Err.{col 39} t{col 47} P>|t|{col 55} [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text} turn{col 14}{c |}{result}{space 2}-.4971904{col 27}{space 1} .165826{col 39} -3.00{col 47}{space 2}0.004{col 55}{space 3} -.82792{col 67}{space 3}-.1664608
{col 1}{text} trunk{col 14}{c |}{result}{space 2} -.222583{col 27}{space 1} .1353748{col 39} -1.64{col 47}{space 2}0.105{col 55}{space 3}-.4925796{col 67}{space 3} .0474136
{col 1}{text}displacement{col 14}{c |}{result}{space 2}-.0196434{col 27}{space 1} .0080013{col 39} -2.46{col 47}{space 2}0.017{col 55}{space 3}-.0356016{col 67}{space 3}-.0036853
{col 1}{text} _cons{col 14}{c |}{result}{space 2} 47.94784{col 27}{space 1} 5.290301{col 39} 9.06{col 47}{space 2}0.000{col 55}{space 3} 37.39667{col 67}{space 3} 58.49902
{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{cmd}. sureg (mpg turn trunk) (displ head gear), noheader
{txt}{hline 13}{c TT}{hline 64}
{c |} Coef. Std. Err. z P>|z| [95% Conf. Interval]
{hline 13}{c +}{hline 64}
{res}mpg {txt}{c |}
turn {c |} {res}-.7319231 .1276395 -5.73 0.000 -.982092 -.4817543
{txt}trunk {c |} {res}-.3189985 .1312914 -2.43 0.015 -.5763249 -.0616721
{txt}_cons {c |} {res} 54.70544 4.254873 12.86 0.000 46.36605 63.04484
{txt}{hline 13}{c +}{hline 64}
{res}displacement {txt}{c |}
headroom {c |} {res} 20.63565 7.225785 2.86 0.004 6.473372 34.79793
{txt}gear_ratio {c |} {res}-150.6982 13.39898 -11.25 0.000 -176.9597 -124.4367
{txt}_cons {c |} {res} 589.8645 52.81358 11.17 0.000 486.3518 693.3772
{txt}{hline 13}{c BT}{hline 64}
{cmd}. _my_tab
{col 1}{text}{hline 13}{c TT}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 14}{text}{c |} Coef.{col 27} Std. Err.{col 39} z{col 47} P>|z|{col 55} [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{result}mpg {col 14}{text}{c |}
{col 1}{text} turn{col 14}{c |}{result}{space 2}-.7319231{col 27}{space 1} .1276395{col 39} -5.73{col 47}{space 2}0.000{col 55}{space 3} -.982092{col 67}{space 3}-.4817543
{col 1}{text} trunk{col 14}{c |}{result}{space 2}-.3189985{col 27}{space 1} .1312914{col 39} -2.43{col 47}{space 2}0.015{col 55}{space 3}-.5763249{col 67}{space 3}-.0616721
{col 1}{text} _cons{col 14}{c |}{result}{space 2} 54.70544{col 27}{space 1} 4.254873{col 39} 12.86{col 47}{space 2}0.000{col 55}{space 3} 46.36605{col 67}{space 3} 63.04484
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{result}displacement{col 14}{text}{c |}
{col 1}{text} headroom{col 14}{c |}{result}{space 2} 20.63565{col 27}{space 1} 7.225785{col 39} 2.86{col 47}{space 2}0.004{col 55}{space 3} 6.473372{col 67}{space 3} 34.79793
{col 1}{text} gear_ratio{col 14}{c |}{result}{space 2}-150.6982{col 27}{space 1} 13.39898{col 39} -11.25{col 47}{space 2}0.000{col 55}{space 3}-176.9597{col 67}{space 3}-124.4367
{col 1}{text} _cons{col 14}{c |}{result}{space 2} 589.8645{col 27}{space 1} 52.81358{col 39} 11.17{col 47}{space 2}0.000{col 55}{space 3} 486.3518{col 67}{space 3} 693.3772
{col 1}{text}{hline 13}{c BT}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{reset}{...}
{* END: _tab_hlp.smcl}{...}
{title:Also see}
{psee}
Online:
{help class},
{helpb ereturn};
{helpb _coef_table}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -