Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72762

Event Study error "no observations"

$
0
0
Hello, dear StataList-ers!

I'm running an Event Study (panel data) and have been using Princeton's "Event Studies with Stata " http://dss.princeton.edu/online_help...ventstudy.html as a reference.

I've divided the data into a few chunks and running it on each one separately, as the whole file is quite big and it gets stuck. It's going on fine but once in awhile, for some files, when estimating the normal performance, it stops and gives me the following error message: (some X id and group_id ) no observations r(2000); end of do-file
[ATTACH=CONFIG]temp_3468_1447567517863_238[/ATTACH]


How to deal with this? Why is this happening ... why "no observations" when all observations that did not meet the specified conditions have been dropped out already? How to solve? Thanks Heaps!

Here are the codes, Im using:

** Trading days **

sort company_id date
by company_id: gen datenum=_n
by company_id: gen target=datenum if date==event_date
egen td=min(target), by(company_id)
drop target
gen dif=datenum-td

by company_id: gen event_window=1 if dif>=-2 & dif<=2
egen count_event_obs=count(event_window), by(company_id)
by company_id: gen estimation_window=1 if dif<-30 & dif>=-60
egen count_est_obs=count(estimation_window), by(company_id)
replace event_window=0 if event_window==.
replace estimation_window=0 if estimation_window==.

drop if count_event_obs < 5
drop if count_est_obs < 30

** Estimating normal performance **

forvalues i=1(1)356 { /*note: replace N with the highest value of id */
l id group_id if id==`i' & dif==0
reg prc vwretd if id==`i' & estimation_window==1
predict p if id==`i'
replace predicted_return = p if id==`i' & event_window==1
drop p
}

Viewing all articles
Browse latest Browse all 72762

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>