I have a data set with the following variables:
- cusip: company identifier
- analystcode: analyst identifier
- forecast: forecasted earnings per share
- eps: actual company earnings per share
- date: date on which the forecast was made
- time: time at which the forecast was made
- epsdate: date of the actual earning announcement made by the company

And I want to compute a variable coverage defined as the number of analysts covering a given earnings announcement. (Hint: in Stata check the command egen...nvals with the option by.)