📄 _repost.ado
字号:
*! version 1.0.1 05feb2002
/* _repost newcmd depv
Purpose:
Some internal commands do not allow -repost-. _repost copies the
"visible" elements into a new estimation result.
You have to specify a new command name so not to confuse post
estimation commands that may refer to hidden structures.
If you specify a depv argument, it is passed to -est post- as the
depname.
*/
program define _repost, eclass
version 8
args newcmd depv
confirm name `newcmd'
// copy macros
local macros : e(macros)
local cmd `e(cmd)'
local cmd2 `e(cmd2)'
local depvar `e(depvar)'
local macros : subinstr local macros "cmd" "", word all
local macros : subinstr local macros "cmd2" "", word all
local macros : subinstr local macros "depvar" "", word all
foreach mac of local macros {
local macro_`mac' `"`e(`mac')'"'
}
// copy scalars
local scalars : e(scalars)
foreach s of local scalars {
tempname scalar_`s'
scalar `scalar_`s'' = e(`s')
}
// copy matrices
local matrices : e(matrices)
tempname b V
mat `b' = e(b)
mat `V' = e(V)
local matrices : subinstr local matrices "b" "", word all
local matrices : subinstr local matrices "V" "", word all
foreach m of local matrices {
tempname matrix_`m'
matrix `matrix_`m'' = e(`m')
}
// copy functions
local functions : e(functions)
if "`functions'" != "sample" {
di as err "unable to repost e(functions) other than e(sample)"
exit 198
}
tempvar touse
gen byte `touse' = e(sample)
// repost the estimation results
if "`depv'" != "" {
local depn depname(`depv')
}
else if "`depvar'" != "" {
local depn depname(`depvar')
}
ereturn clear
ereturn post `b' `V' , esample(`touse') `depn'
// recopy matrices, scalars, macros
foreach m of local matrices {
ereturn matrix `m' `matrix_`m''
}
foreach s of local scalars {
ereturn scalar `s' = `scalar_`s''
}
foreach mac of local macros {
ereturn local `mac' `"`macro_`mac''"'
}
ereturn local old_cmd `cmd'
ereturn local old_cmd2 `cmd2'
ereturn local cmd `newcmd'
end
exit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -