Hi there,
I am currently conducting an event study on Stata aiming to investigate the effect of Elon Musk's tweets on the stock market. However, some tweets seem to have been posted on non-trading days. Therefore, when I compute the following commands, the tweet dates are not matched with the date of the stock returns, making my analysis invalid.
sort group_id date
by group_id: gen datenum=_n
by group_id: gen target=datenum if date==event_date
egen td=min(target), by(group_id)
drop target
gen dif=datenum-td
I am attaching a screenshot of my data:
1. Company (or sub-group) whose tweet was posted on a trading day
2. Company (or sub-group) whose tweet was not posted on a trading day
How can I overcome this issue?
Many thanks!
I am currently conducting an event study on Stata aiming to investigate the effect of Elon Musk's tweets on the stock market. However, some tweets seem to have been posted on non-trading days. Therefore, when I compute the following commands, the tweet dates are not matched with the date of the stock returns, making my analysis invalid.
sort group_id date
by group_id: gen datenum=_n
by group_id: gen target=datenum if date==event_date
egen td=min(target), by(group_id)
drop target
gen dif=datenum-td
I am attaching a screenshot of my data:
1. Company (or sub-group) whose tweet was posted on a trading day
2. Company (or sub-group) whose tweet was not posted on a trading day
How can I overcome this issue?
Many thanks!

Comment