xtset id date
gen a = .
forvalues i=1/10000 {
reg y x w z if id==`i'
replace a=_b[x] if id=`i'&n==1
replace a=_b[w] if id=`i'&n==2
replace a=_b[z] if id=`i'&n==3
}
问题是在有几只股票的时候返回了错误信息,说matrix is not positive defined, 然后程序就停了。 有没有什么方法不让程序停下来,如果这支股票不行就去做下一只。我查了一下貌似是capture命令,但是具体怎么用呢,加在程序哪一行?麻烦各位大侠了。另外这个程序不知为什么特别慢,一万个股票要算大概2-3个小时,请问正常吗?
g a = .
forv i=1/10000{
cap {
reg y x w z if id==`i'
replace a=_b[x] if e(sample)&n==1
replace a=_b[w] if e(sample)&n==2
replace a=_b[z] if e(sample)&n==3
}
}