Hi,

I want to create a variable that shows the 5 year growth rate. My first thought is to write something like:

by CountryName: gen growth5 = (GDP- GDP[n_-5])/GDP_[n_-5]

But that won't work when there are missing years. For example if 1996 is missing, 5 years before 1997 will be computed as 1991(or more obviously, 1 year before 1997 will be marked as 1995 if 1996 is missing). What can I do instead?

Thank you!