I have a panel dataset and need to take the lag of the total population with a 5-year interval so that in the end I can get the average growth rate.
For that purpose, the command I used are:
rename Year_ Population_growth
gen lag1 = Population_growth[_n-1]
gen growth_rate = (Population_growth-lag1[_n-5]/lag1[_n-5])*100
My dataset looks something like this:
Country_name Year Country_code Population_growth _merge
Afghanistan 1950 4 7752.117 matched (3)
Algeria 1951 4 7840.151 matched (3)
Afghanistan 1952 4 8039.684 matched (3)
Angola 1954 4 8151.316 matched (3)
Afghanistan 1955 4 8270.992 matched (3)
Please let me know the commands that could be used to calculate population growth and then the average growth rate of the dataset?
For that purpose, the command I used are:
rename Year_ Population_growth
gen lag1 = Population_growth[_n-1]
gen growth_rate = (Population_growth-lag1[_n-5]/lag1[_n-5])*100
My dataset looks something like this:
Country_name Year Country_code Population_growth _merge
Afghanistan 1950 4 7752.117 matched (3)
Algeria 1951 4 7840.151 matched (3)
Afghanistan 1952 4 8039.684 matched (3)
Angola 1954 4 8151.316 matched (3)
Afghanistan 1955 4 8270.992 matched (3)
Please let me know the commands that could be used to calculate population growth and then the average growth rate of the dataset?
Comment