Hi all,

I am new to Stata and I have the following problem.

I have to conduct an event study for 1,500 US firms, having different event dates, i.e. announcement of activism campaign.

I have the following data:
- For each firm, I have the series of returns in the 250 days before the announcement, paired (in the next column) with the corresponding date
- For each of the 4 Fama French Carhart factors, I have the series of returns paired with the corresponding dates, which cover the entire of range of dates of the returns of the firms.

As far as I am concerned, the first step would be to estimate a time series regression of the returns of a firm on the returns 4 Fama-French-Carhart factors in the 250 days before the announcement. This time series regression should be repeated for each firm in the sample, so:
- The y variable (i.e. returns of the firm) should be different in each of the 1,500 time series regressions;
- The dependent variables are the same for each regression (FFC factors)
- The 250 dates are different for each regression

I was thinking to build a "loop" that for each company should automatically regress its returns on the 4 FFC Factors, automatically selecting only 250 the relevant dates for the FFC factors.

Did I explain sufficiently clearly my problem?

Any suggestions on how to do it?