gen Indcd=1 if strmatch( Industry,"A")
replace Indcd=2 if strmatch( Industry,"B")
replace Indcd=3 if strmatch( Industry,"C1")
replace Indcd=4 if strmatch( Industry,"C2")
replace Indcd=5 if strmatch( Industry,"C3")
replace Indcd=6 if strmatch( Industry,"C4")
replace Indcd=7 if strmatch( Industry,"D")
replace Indcd=8 if strmatch( Industry,"E")
replace Indcd=9 if strmatch( Industry,"F")
replace Indcd=10 if strmatch( Industry,"G")
replace Indcd=11 if strmatch( Industry,"H")
replace Indcd=12 if strmatch( Industry,"I")
replace Indcd=13 if strmatch( Industry,"K")
replace Indcd=14 if strmatch( Industry,"L")
replace Indcd=15 if strmatch( Industry,"M")
replace Indcd=16 if strmatch( Industry,"N")
replace Indcd=17 if strmatch( Industry,"P")
replace Indcd=18 if strmatch( Industry,"Q")
replace Indcd=19 if strmatch( Industry,"R")
replace Indcd=20 if strmatch( Industry,"S")
gen inv=.
forvalues i=2008/2012 {
forvalues j=1/20 {
reg NewInvt TobinQ AReturn Cash Age LagInvest SIZE LEV if year==`i' & Indcd==`j'
predict e
replace inv=e if year==`i' & Indcd==`j'
drop e
}
}
这个命令怎么不循环呢?只有2008年一年的数据,而且P、Q、R、S四个行业也没有值!