Dear all,

I am trying to calculate the average ESG score for a specific industry for a given year using Stata. However, I am struggling to find the correct command.
By using:

Code:
 bysort Year: egen MeanIndustryEsg = mean(ESG_score)
I get the mean ESG score for a given year. How do I incorporate the industry variable though (I want the average for a specific industry and not over all industries)?

Any help is appreciated!
Thanks a lot!