Hi Statalist Community,
I am working with a panel dataset where I am trying to create gdp_growth from the log of real gdp per capita.
I would like to generate the 5-year difference(growth) of country A(and other countries) between log_gdp_1994 and log_gdp_1990, then the difference of log_gdp_1999 and log_gdp_1995(so non-overlapping), and so on....how can this be done in Stata?
Is there perhaps a command that generates these 5-year differences for the whole dataset?
My dataset starts from year 1990 to 2018 for 60 different countries.
Furthermore, let's assume that the log_gdp_pc in year 1990 of country A is missing. How may I take the average of the non-missing observations from the other years(1991-1993) and substract it from log_gdp_1994? How can I put it as a condition, that if the first observation of the difference( so, 1990, 1995, 2000, ect...)
is missing from the 5-year differences, the command is to take the average of the non-missing other years without the last year(in the inquiry above the last year would be 1994), and substract it from the last year( year 1994) to get the growth?
This is how the data looks like:
Thank you for your help!
Kris
I am working with a panel dataset where I am trying to create gdp_growth from the log of real gdp per capita.
I would like to generate the 5-year difference(growth) of country A(and other countries) between log_gdp_1994 and log_gdp_1990, then the difference of log_gdp_1999 and log_gdp_1995(so non-overlapping), and so on....how can this be done in Stata?
Is there perhaps a command that generates these 5-year differences for the whole dataset?
My dataset starts from year 1990 to 2018 for 60 different countries.
Furthermore, let's assume that the log_gdp_pc in year 1990 of country A is missing. How may I take the average of the non-missing observations from the other years(1991-1993) and substract it from log_gdp_1994? How can I put it as a condition, that if the first observation of the difference( so, 1990, 1995, 2000, ect...)
is missing from the 5-year differences, the command is to take the average of the non-missing other years without the last year(in the inquiry above the last year would be 1994), and substract it from the last year( year 1994) to get the growth?
This is how the data looks like:
Country | year | log_gdp_pc |
A | 1990 | 1111 |
A | 1991 | 1212 |
A | 1992 | 1222 |
A | 1993 | 1221 |
A | 1994 | 2211 |
A | 1995 | 1212 |
Kris
Comment