Hello all,

I am working on a project regarding house prices, aggregated by grids and quarter, and I am trying to implement an event-study.
I am following the guidelines from Princeton, https://dss.princeton.edu/online_hel...ventstudy.html, and wrote the following command:

gen predicted_price=.
egen id=group(nid)
forvalues i=1(1)3469{
l id nid if id==`i' & var1==0
reghdfe norm_price x1 x2 x3 if id==`i' & estimation_window==1, a(nid quarter) vce(cluster nid quarter)
predict p if id==`i'
replace predicted_price = p if id==`i' & event_window==1
drop p
}

When I run it, I get the error r(2001) "insufficient observations". This is very puzzling as I have a very large dateset.
I then tried:

gen predicted_price=.
egen id=group(nid)
forvalues i=1(1)3469{
l id nid if id==`i' & var1==0
capture reghdfe norm_price x1 x2 x3 if id==`i' & estimation_window==1, a(nid quarter) vce(cluster nid quarter)
predict p if id==`i'
replace predicted_price = p if id==`i' & event_window==1
drop p
}

and got the error r(301) 'last estimates not found'.
If anyone could help me, I would greatly appreciate.

Thank you!