use tobacco.dta,clear
reg share2 lnx nadults nkids nkids2
truncreg share2 lnx age nadults nkids nkids2,ll(0) nolog
tobit share2 lnx age nadults nkids nkids2,ll(0) nolog
foreach i of share2{
replace `i'=. if`i'==0
}
heckman share2 lnx age nadults nkids nkids2,select(age nadults nkids nkids2) twostep nolog
完整代码如上:
replace 'i'=. if'i'==0时出现' invalid name
改成replace `i'=. if`i'==0后出现invalid 'ifshare2'
把replace `i'=.if`i'==0中=.后面的空格删去出现.ifshare2 invalid name
把in改成of:
. foreach i of share2{
2. replace `i'=. if`i'==0
3. }
出现invalid syntax
有人知道到底该怎么改吗?