Hello everyone,
I need help with the following code. I am having problems in running the following forvalues command in my Event Study about M&A:
forvalues i=1(1)`r(max)' {
l id event_id if id==`i' & dif==0
qui 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
}
*
Everytime I launch this code that is aimed at creating an expected, market model return according to the data I have about stock returns and market returns, I get an error message that says I have "no observations" after id=43 (the total number of idea is roughly 1800).
At id 43 I have a column of "NA" data, so I guess that's the problem.
I have tried to apply the "capture" command in front of "reg" and in front of "predict" and "replace" too, but things still don't work.
Do you have any ideas about how to override or avoid this issue?
Thanks in advance to anyone who will reply.
Alessandro Duccio
I need help with the following code. I am having problems in running the following forvalues command in my Event Study about M&A:
forvalues i=1(1)`r(max)' {
l id event_id if id==`i' & dif==0
qui 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
}
*
Everytime I launch this code that is aimed at creating an expected, market model return according to the data I have about stock returns and market returns, I get an error message that says I have "no observations" after id=43 (the total number of idea is roughly 1800).
At id 43 I have a column of "NA" data, so I guess that's the problem.
I have tried to apply the "capture" command in front of "reg" and in front of "predict" and "replace" too, but things still don't work.
Do you have any ideas about how to override or avoid this issue?
Thanks in advance to anyone who will reply.
Alessandro Duccio
Comment