Hello all ,
I am trying to obtain cumulative abnormal returns using stata based on event dates . However when I run the loop foreach am not able to get the desired result because i get the error error 123 : invalide numlist has too many elements .
The following is my code:
egen ID = group(permno)
foreach i of numlist 1 / 2701 {
quietly regress ret vwretd if ID == `i' & estimation_window == 1
predict p if ID == `i'
replace predicted_return = p if ID == `i'
drop p
}
Can you tell me where i went wrong or how i could make this code better ?
Thanks and Regards,
Kishore
I am trying to obtain cumulative abnormal returns using stata based on event dates . However when I run the loop foreach am not able to get the desired result because i get the error error 123 : invalide numlist has too many elements .
The following is my code:
egen ID = group(permno)
foreach i of numlist 1 / 2701 {
quietly regress ret vwretd if ID == `i' & estimation_window == 1
predict p if ID == `i'
replace predicted_return = p if ID == `i'
drop p
}
Can you tell me where i went wrong or how i could make this code better ?
Thanks and Regards,
Kishore
Comment