Hi,

I am currently writing my thesis but unfortunately ran into some problems with calculating a variable in stata.

My (panel)dataset consists of 48,000 observations all data of firms from year 2006 to 2014

The variable i am trying to create is efwamb which is denoted by this formula: Array

e and d are equity issues and debt issues respectively, M/B is the market to book ratio in any given year. For every year the M/B ratio is multiplied by the weight of equity and debt issues divided by the sum of total equity and debt issues of the starting years until the year i am calculating the efwamb for. So for example 2006 and 2008:
Array
Array

I have calculated the e and d issues in every year, as well as the M/B ratios and cumulative sum of e and d for every year. So I now have the nominator and denominator available but am really struggling with calculating these weights.

Would anyone know an easy way to calculate this? Would be much appreciated!

Bob