------------------------------------------
clear
di tm(2011-05) //616
di tm(2012-03) //623
forvalues i=616/623{
gen month`i'=`i'
format month`i' %tm
tostring month`i', force replace usedisplayformat
local m=month`i'[1]
gen post`m'=1
replace post`m'=0 if time<`i'
gen treat_post`m'=treat*post`m'
drop month`i'
}
--------------------------------------------
我是stata freshman一名,把这个当小练习做哈,写这个程序时有另外一个人的帮助:https://bbs.pinggu.org/thread-3882595-1-1.html