Dear Statalist,
I'd really appreciate any help members have to offer with my problem.
I'm running an event study on the princeton method (http://dss.princeton.edu/online_help...ventstudy.html). I've successfully merged my market data , with 316 events over 8 years.
My event window is (-5;-2) and estimation window is (-205;-6)
I used the following codes:
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>=-5 & dif<=-2
egen count_event_obs=count(event_window), by(company_id)
by company_id: gen estimation_window=1 if dif<-6 & dif>=-205
egen count_est_obs=count(estimation_window), by(company_id)
replace event_window=0 if event_window==.
replace estimation_window=0 if estimation_window==.
tab company_id if count_event_obs<4
tab company_id if count_est_obs<200
drop if count_event_obs < 4
drop if count_est_obs < 200
However, both my event and estimation window turned out to be all 0. Therefore, when I used the drop command, there is no value lelf.
Is there any problem with my code.
Thank you in advance.
I'd really appreciate any help members have to offer with my problem.
I'm running an event study on the princeton method (http://dss.princeton.edu/online_help...ventstudy.html). I've successfully merged my market data , with 316 events over 8 years.
My event window is (-5;-2) and estimation window is (-205;-6)
I used the following codes:
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>=-5 & dif<=-2
egen count_event_obs=count(event_window), by(company_id)
by company_id: gen estimation_window=1 if dif<-6 & dif>=-205
egen count_est_obs=count(estimation_window), by(company_id)
replace event_window=0 if event_window==.
replace estimation_window=0 if estimation_window==.
tab company_id if count_event_obs<4
tab company_id if count_est_obs<200
drop if count_event_obs < 4
drop if count_est_obs < 200
However, both my event and estimation window turned out to be all 0. Therefore, when I used the drop command, there is no value lelf.
Is there any problem with my code.
Thank you in advance.
Comment