I use Stata 14.2. I have a panel data at firm-year level. I want to calculate mean(Sales) at industry-year level, after removing the focal firm. I understand that egen command will allow to do this at industry-year level. But I do not know how to do it after removing the sales of the focal firm. Moreover, the number of firms in a industry is not fixed across the panel as the panel is unbalanced.
Company | Year | Sales | Industry |
ABC | 1998 | 10 | 1 |
BCD | 1998 | 14 | 1 |
CDE | 1998 | 12 | 1 |
DEF | 1998 | 67 | 2 |
EFG | 1998 | 55 | 2 |
FGH | 1998 | 60 | 2 |
Comment