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!
Related Posts with using lagged values to find 5 year growth rate when there are missing years in the data
Aggregating law dataHi all. I'm using voter data from Anes but have a problem about the data only giving me the state o…
Generating New Variable with several values of one existing variable using "Wildcards"Hello Statalist, I am trying to generate a new variable based on an existing variable. The existing…
Limiting the y-axis on a marginsplot graphI'm creating a marginsplot graph for a probit model estimating predicted probabilities. Some of the …
Frequency of TransactionHello Statlist, hope everyone is in good condition I've yearly dataset about supplier sale from maj…
Rename country id in a paneldataDear Statalisters. I am working with two different panal datasets which I want to merge. Unfortunat…
Subscribe to:
Post Comments (Atom)
0 Response to using lagged values to find 5 year growth rate when there are missing years in the data
Post a Comment