jjjj6666 发表于 2014-2-16 23:36 
gen double d=abs(event_day-trading_day)
egen double x= min(d), by(group_id)
gen evt_dat_near_t_day ...
Hi, I met a new obstable when running the regression below, the error is shown as above.
The reason is, in some certain cases, the first row of the return is empty (something wrong with the data), but the security info of the first stockdate often would not be used in the regression, but stata shows "no observations".
How could i jump it or neglect it? I tried to drop id=194, but it does not work.
gen predicted_return=.egen id=group(company_id) /* for multiple event dates, use: egen id = group(group_id) */forvalues i=1(1)N { /*note: replace N with the highest value of id */ l id company_id if id==`i' & dif==0 reg ret market_return if id==`i' & estimation_window==1 predict p if id==`i' replace predicted_return = p if id==`i' & event_window==1 drop p}