Dear Statalist,

I am trying to generate the mean value of a locality, excluding the focal firm and firms in the same industry as the focal firms. Specifically, I have 100 firms located in 10 provinces across 13 industries. I attempt to calculate the average leverage of all firms located in province j, excluding the focal firm i and its industry rivals.

Any suggestions would be highly appreciated!

Best regards,

Yiyi