📄 datetof.ado
字号:
*! version 2.1.0 02/27/93
program define datetof
version 3.1
local varlist "req ex max(1)"
local if "opt"
local in "opt"
local options "Generate(string)"
parse "`*'"
if "`generat'"=="" { error 198 }
conf new var `generat'
conf string var `varlist'
local type : type `varlist'
tempvar touse s1 left right mid yr
quietly {
gen byte `touse' = 0
replace `touse' = 1 `if' `in'
gen byte `s1'=index(`varlist',"/") if `touse'
replace `touse'=0 if `s1'<=1 & `touse'
gen `type' `left' = substr(`varlist',1,`s1'-1) if `touse'
compress `left'
gen `type' `right' = substr(`varlist',`s1'+1,.) if `touse'
compress `right'
replace `s1' = index(`right',"/") if `touse'
replace `touse'=0 if `s1'<=1 & `touse'
gen `type' `mid' = substr(`right',1,`s1'-1) if `touse'
compress `mid'
replace `right' = substr(`right',`s1'+1,.) if `touse'
drop `s1'
compress `right'
trim right `left' if `touse'
trim right `mid' if `touse'
trim right `right' if `touse'
gen int `yr'=real(`right') if `touse'
}
#delimit ;
gen long `generat'= cond(`yr'>1900,`yr'-1900,`yr')*10000
+ real(`left')*100
+ real(`mid') if `touse' ;
#delimit cr
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -