Hi,
I have GDP data for countries. But one country changed the way it calculated GDP in one period. Therefore the growth rate in this period is very high. In the following sample that would be France in the year 2002.
input str7 country int year byte gdp
"France" 1999 58
"France" 2000 59
"France" 2001 56
"France" 2002 80
"France" 2003 82
"France" 2004 84
"Germany" 2000 42
"Germany" 2000 44
"Germany" 2001 47
"Germany" 2002 48
"Germany" 2003 50
"Germany" 2004 51
end
*Calculate the growth rates:
bysort country (year): gen gdp_growth = (gdp-gdp[_n-1])/gdp[_n-1]
country year gdp gdp_growth
France 1999 58
France 2000 59 .0172414
France 2001 56 -.0508475
France 2002 80 .4285714
France 2003 82 .025
France 2004 84 .0243902
Germany 2000 42
Germany 2000 44 .047619
Germany 2001 47 .0681818
Germany 2002 48 .0212766
Germany 2003 50 .0416667
Germany 2004 51 .02
* Now, to make the data more plausible again, I replace the high growth rate by the average growth rate of the last two year as follows:
bysort country (year): gen gdp_growth_av = (gdp_growth[_n-1]+gdp_growth[_n-2])/2
replace gdp_growth = gdp_growth_av if country== "France" & year == 2002
drop gdp_growth_av
This gives me the following:
country year gdp gdp_growth
France 1999 58
France 2000 59 .0172414
France 2001 56 -.0508475
France 2002 80 -.016803
France 2003 82 .025
France 2004 84 .0243902
Germany 2000 42
Germany 2000 44 .047619
Germany 2001 47 .0681818
Germany 2002 48 .0212766
Germany 2003 50 .0416667
Germany 2004 51 .02
Now, I want to build a new GDP series for France as of 2002, i.e., take the gdp value of 2001 and use the new growth rate for 2002 to calculate a new GDP value for 2002. Then, use the new GDP value from 2002 and the growth rate for 2003 to calculate a new GDP value for 2003 and so on.
How can I do that? Thanks in advance!
I have GDP data for countries. But one country changed the way it calculated GDP in one period. Therefore the growth rate in this period is very high. In the following sample that would be France in the year 2002.
input str7 country int year byte gdp
"France" 1999 58
"France" 2000 59
"France" 2001 56
"France" 2002 80
"France" 2003 82
"France" 2004 84
"Germany" 2000 42
"Germany" 2000 44
"Germany" 2001 47
"Germany" 2002 48
"Germany" 2003 50
"Germany" 2004 51
end
*Calculate the growth rates:
bysort country (year): gen gdp_growth = (gdp-gdp[_n-1])/gdp[_n-1]
country year gdp gdp_growth
France 1999 58
France 2000 59 .0172414
France 2001 56 -.0508475
France 2002 80 .4285714
France 2003 82 .025
France 2004 84 .0243902
Germany 2000 42
Germany 2000 44 .047619
Germany 2001 47 .0681818
Germany 2002 48 .0212766
Germany 2003 50 .0416667
Germany 2004 51 .02
* Now, to make the data more plausible again, I replace the high growth rate by the average growth rate of the last two year as follows:
bysort country (year): gen gdp_growth_av = (gdp_growth[_n-1]+gdp_growth[_n-2])/2
replace gdp_growth = gdp_growth_av if country== "France" & year == 2002
drop gdp_growth_av
This gives me the following:
country year gdp gdp_growth
France 1999 58
France 2000 59 .0172414
France 2001 56 -.0508475
France 2002 80 -.016803
France 2003 82 .025
France 2004 84 .0243902
Germany 2000 42
Germany 2000 44 .047619
Germany 2001 47 .0681818
Germany 2002 48 .0212766
Germany 2003 50 .0416667
Germany 2004 51 .02
Now, I want to build a new GDP series for France as of 2002, i.e., take the gdp value of 2001 and use the new growth rate for 2002 to calculate a new GDP value for 2002. Then, use the new GDP value from 2002 and the growth rate for 2003 to calculate a new GDP value for 2003 and so on.
How can I do that? Thanks in advance!
Comment