Hi everyone,

I am running event study using princeton example https://dss.princeton.edu/online_hel...ventstudy.html
Everything runs correctly until the command below.
What stata does is run the regressions for 535 companies and then the error message pops up no observations r(2000). Thus I miss regression for rest 278 companies. (In total 813 companies in my event study)
Could you help me solve this issue?

gen predicted_return=.
egen id=group(company_id)
forvalues i=1(1)813 {
l id company_id if id==`i' & dif==0
reg ret_price ret_index if id==`i' & estimation_window==1
predict p if id==`i'
replace predicted_return = p if id==`i' & event_window==1
drop p
}

Thanks!
Ola