📄 streset.ado
字号:
*! version 6.0.3 15sep2004
/*
streset
stset, [no]show
stset, clear
stset time cat[, options]
*/
program define streset
version 6, missing
st_is 2 full
capture syntax [, Show Full Past Future]
if _rc==0 {
if "`full'"!="" | "`past'"!="" | "`future'"!="" {
if "`past'"=="" & "`future'"=="" {
di in red "must specify"
di in red _col(8) ". streset, full past"
di in red _col(8) ". streset, full future"
di in red _col(8) ". streset, full past future"
exit 198
}
Full `past' `future'
exit
}
if "`show'"!="" {
char _dta[st_show]
exit
}
syntax [, noShow]
if "`show'"!="" {
char _dta[st_show] "noshow"
exit
}
if `"`_dta[st_full]'"'!="" {
Anal
exit
}
}
if `"`_dta[st_set]'"' != "" {
di in red `"`_dta[st_set]'"'
exit 119
}
if "`_dta[st_full]'"!="" {
if _rc {
di in red `"After "streset, full `_dta[st_full]'","'
di in red /*
*/ `"you must type "streset" without options first"'
exit 198
}
}
local shopt = cond("`_dta[st_show]'"=="", "noShow", "Show")
syntax [if/] [fw pw iw/] [, /*
*/ AFTER(string) /*
*/ BEFORe(string) /*
*/ ID(varname) /*
*/ ENter(string) ENTRy(string) /*
*/ EXit(string) /*
*/ EVER(string) /*
*/ Failure(string) /*
*/ IFopt(string) /*
*/ NEVER(string) /*
*/ Origin(string) /*
*/ SCale(string) /*
*/ noShow /*
*/ TIME0(string) ]
Get id st_id `"`id'"'
local bt `_dta[st_bt]'
Get time0 st_bt0 `"`time0'"'
if `"`failure'"'=="" {
local failure `"`_dta[st_bd]'"'
if `"`_dta[st_ev]'"'!="" {
local failure `"`failure'==`_dta[st_ev]'"'
}
}
if `"`entry'"' != "" {
if `"`enter'"' != "" {
error 198
}
local enter `"`entry'"'
}
Get scale st_bs `"`scale'"'
Get enter st_enter `"`enter'"'
Get exit st_exit `"`exit'"'
Get origin st_orig `"`origin'"'
Get ifexp st_ifexp `"`if'"'
Get ifopt st_if `"`ifopt'"'
Get ever st_ever `"`ever'"'
Get never st_never `"`never'"'
Get after st_after `"`after'"'
Get before st_befor `"`before'"'
if `"`weight'"' == "" {
local weight `"`_dta[st_wt]'"'
local exp `"`_dta[st_wv]'"'
}
Get show st_show `"`show'"'
st_set set "" /*
*/ "`id'" "`bt'" `"`time0'"' `"`failure'"' `scale' /*
*/ `"`enter'"' `"`exit'"' `"`origin'"' /*
*/ `"`ifexp'"' `"`ifopt'"' `"`ever'"' /*
*/ `"`never'"' `"`after'"' `"`before'"' /*
*/ "`weight'" `"`exp'"' "`show'"
end
program define Get
args lname default cnts
if `"`cnts'"' != "" {
c_local `lname' `"`cnts'"'
}
else c_local `lname' `"`_dta[`default']'"'
end
program define Full /* past | future | past future */
local arg = trim(`"`0'"')
if "`_dta[st_id]'"=="" {
di in red /*
*/ `"" streset, full" relevant only if id() variable has been stset"'
exit 198
}
if "`_dta[st_full]'"!="" {
if `"`_dta[st_full]'"' == `"`arg'"' {
di in gr "(data already full `arg')"
exit
}
di in red `"data is full `_dta[st_full]'"'
di in red `"you must type "streset" without arguments first"'
exit 198
}
if `"`_dta[st_set]'"' != "" {
di in red `"`_dta[st_set]'"'
exit 119
}
local failure `"`_dta[st_bd]'"'
if `"`_dta[st_ev]'"'!="" {
local failure `"`failure'==`_dta[st_ev]'"'
}
#delimit
st_set set ""
`"`_dta[st_id]'"' `"`_dta[st_bt]'"' `"`_dta[st_bt0]'"'
`"`failure'"' `"`_dta[st_bs]'"'
`"`_dta[st_enter]'"' `"`_dta[st_exit]'"' `"`_dta[st_orig]'"'
`"`_dta[st_ifexp]'"' `"`_dta[st_if]'"'
`"`_dta[st_ever]'"' `"`_dta[st_never]'"'
`"`_dta[st_after]'"' `"`_dta[st_befor]'"'
`"`_dta[st_wt]'"' `"`_dta[st_wv]'"'
`"`_dta[st_show]'"'
`"`arg'"'
;
#delimit cr
end
program define Anal
if "`_dta[st_id]'"=="" {
di in red /*
*/ `""streset, analysis" relevant only if id() variable has been stset"'
exit 198
}
if "`_dta[st_full]'"=="" {
di in gr "(data already analysis subsample)"
exit
}
if `"`_dta[st_set]'"' != "" {
di in red `"`_dta[st_set]'"'
exit 119
}
local failure `"`_dta[st_bd]'"'
if `"`_dta[st_ev]'"'!="" {
local failure `"`failure'==`_dta[st_ev]'"'
}
#delimit
st_set set ""
`"`_dta[st_id]'"'
`"`_dta[st_bt]'"'
`"`_dta[st_bt0]'"'
`"`failure'"'
`"`_dta[st_bs]'"'
`"`_dta[st_fente]'"'
`"`_dta[st_fexit]'"'
`"`_dta[st_forig]'"'
`"`_dta[st_ifexp]'"'
`"`_dta[st_fif]'"'
`"`_dta[st_fever]'"'
`"`_dta[st_never]'"'
`"`_dta[st_fafter]'"'
`"`_dta[st_fbefor]'"'
`"`_dta[st_wt]'"'
`"`_dta[st_wv]'"'
`"`_dta[st_show'"'
;
#delimit cr
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -