# Calculate HHI

#### Gerrit Komrij

##### New Member
Hi Guys,

i am pretty new when it comes to using stata, since i need it to finish my master thesis. Now i have to to calculate the HHI for over 2000 observations. My data is structured as follows

Bank Year Albania Andorra Armenia Austria Belarus
Bank of China Limited 2014 0,234 0,11 0 0 0
Bank of China Limited 2013 0,774 0,11 0 0 0
Bank of China Limited 2012 0,435 0,11 0 0 0
Bank of China Limited 2011 0,435 0,11 0 0 0
Bank of China Limited 2010 0,987 0,11 0 0 0
Bank of China Limited 2009 0,322 0,11 0 0 0
Banco Bilbao Vizcaya 2014 0,234 0,11 0 0 0
Banco Bilbao Vizcaya 2013 0,44 0,11 0 0 0
Banco Bilbao Vizcaya 2012 0,222 0,11 0 0 0

all the way to Z.

How do i generate a new variable that calculates the HHI for each bank for each year?

If someone could help me with the could i would appreciate it very much!

GK

#### hlsmith

##### Less is more. Stay pure. Stay poor.
What is HHI, is this an economic term?

#### Gerrit Komrij

##### New Member
Sorry, forgot to mention that!

HHI stands for Herfindahl-Hirschman Index and is a measurement for market concentration. It is calculated as follows:

HHI = s1^2 + s2^2 + s3^2 + ... + sn^2 (where sn is the market share of the each country).

It is usually used to calculate for all the companies in a specific market, but i use it to calculate the spread of a company's loans.