-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtimedummy.ado
More file actions
31 lines (25 loc) · 860 Bytes
/
timedummy.ado
File metadata and controls
31 lines (25 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
program timedummy, rclass
version 14
syntax , epoch(varlist min=1 max=1) periods(string) varstem(string) ///
[leftperiods(string) surround]
if "`leftperiods'" == "" {
local leftperiods = `periods'
}
cap gen `varstem' = (`epoch' == 0)
label variable `varstem' "0"
forvalues i = 1(1)`leftperiods' {
qui gen `varstem'_f`i' = (`epoch' == -`i')
label variable `varstem'_f`i' "-`i'"
}
forvalues i = 1(1)`periods' {
qui gen `varstem'_l`i' = (`epoch' == `i')
label variable `varstem'_l`i' "`i'"
}
// Create variables for pre and postperiods if surround was selected
if "`surround'" == "surround" {
qui gen `varstem'_pre = (`epoch' < -`leftperiods')
label variable `varstem'_pre "pre"
qui gen `varstem'_post = (`epoch' > `periods')
label variable `varstem'_post "post"
}
end