Dear Stata-group,
I have a panel set of roughly 120 countries from 1950-2014. I would like to generate for a given year, a given country's (per capita) gdp relative to the UK's (per capita) gdp.
Thus, I would like to end up with relative per capita gdp data, for a given country and year. This generated measurement would then be equal to ONE for all UK years.
I am not sure how to program this. Below you find the country, year, (per capita) pcgdp, and pcgdp_500. The last variable indicates pcgdp of the UK. I generated this variable with:
gen pcgdp_500 = pcgdp if country==500. I am sure you see the problem right away. I now have missings for pcgdp_500 given Ireland for example. I guess what I want to do is replace those missings with the UK pcgdp data.
Any thoughts on how to approach this are highly appreciated.
Thanks.
Nico
I have a panel set of roughly 120 countries from 1950-2014. I would like to generate for a given year, a given country's (per capita) gdp relative to the UK's (per capita) gdp.
Thus, I would like to end up with relative per capita gdp data, for a given country and year. This generated measurement would then be equal to ONE for all UK years.
I am not sure how to program this. Below you find the country, year, (per capita) pcgdp, and pcgdp_500. The last variable indicates pcgdp of the UK. I generated this variable with:
gen pcgdp_500 = pcgdp if country==500. I am sure you see the problem right away. I now have missings for pcgdp_500 given Ireland for example. I guess what I want to do is replace those missings with the UK pcgdp data.
Any thoughts on how to approach this are highly appreciated.
Thanks.
Nico
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str34 country int year float(pcgdp pcgdp_500) "Ireland" 1950 4955.12 . "Ireland" 1951 5021.714 . "Ireland" 1952 5222.566 . "Ireland" 1953 5354.091 . "Ireland" 1954 5437.673 . "Ireland" 1955 5612.619 . "Ireland" 1956 5577.02 . "Ireland" 1957 5576.546 . "Ireland" 1958 5529.907 . "Ireland" 1959 5786.975 . "Ireland" 1960 6096.831 . "Ireland" 1961 6410.824 . "Ireland" 1962 6547.728 . "Ireland" 1963 6806.927 . "Ireland" 1964 6983.225 . "Ireland" 1965 7059.32 . "Ireland" 1966 7149.395 . "Ireland" 1967 7535.281 . "Ireland" 1968 8085.522 . "Ireland" 1969 8450.145 . "Ireland" 1970 8502.601 . "Ireland" 1971 8685.761 . "Ireland" 1972 9227.008 . "Ireland" 1973 9618.061 . "Ireland" 1974 9688.893 . "Ireland" 1975 9968.942 . "Ireland" 1976 10253.032 . "Ireland" 1977 11107.25 . "Ireland" 1978 11991.986 . "Ireland" 1979 12464.86 . "Ireland" 1980 12844.02 . "Ireland" 1981 12918.134 . "Ireland" 1982 12938.853 . "Ireland" 1983 12598.97 . "Ireland" 1984 12808.943 . "Ireland" 1985 12786.83 . "Ireland" 1986 13538.96 . "Ireland" 1987 14462.34 . "Ireland" 1988 15060.1 . "Ireland" 1989 16055.55 . "Ireland" 1990 17329.584 . "Ireland" 1991 17576.514 . "Ireland" 1992 18742.475 . "Ireland" 1993 19803.594 . "Ireland" 1994 20667.73 . "Ireland" 1995 23648.355 . "Ireland" 1996 25320.766 . "Ireland" 1997 28035.773 . "Ireland" 1998 30414.014 . "Ireland" 1999 32486.77 . "Ireland" 2000 35921.473 . "Ireland" 2001 38002.125 . "Ireland" 2002 42167.17 . "Ireland" 2003 45081.43 . "Ireland" 2004 46680.24 . "Ireland" 2005 49606.06 . "Ireland" 2006 49484.54 . "Ireland" 2007 53823.52 . "Ireland" 2008 50340.82 . "Ireland" 2009 47944.63 . "Ireland" 2010 47709.39 . "Ireland" 2011 48981.26 . "Ireland" 2012 48648.04 . "Ireland" 2013 49337.35 . "Ireland" 2014 51926.82 . "United Kingdom" 1950 9453.852 9453.852 "United Kingdom" 1951 9735.309 9735.309 "United Kingdom" 1952 9660.0625 9660.0625 "United Kingdom" 1953 10122.758 10122.758 "United Kingdom" 1954 10476.356 10476.356 "United Kingdom" 1955 10859.636 10859.636 "United Kingdom" 1956 11025.61 11025.61 "United Kingdom" 1957 11187.716 11187.716 "United Kingdom" 1958 11181.505 11181.505 "United Kingdom" 1959 11503.85 11503.85 "United Kingdom" 1960 11968.65 11968.65 "United Kingdom" 1961 12175.857 12175.857 "United Kingdom" 1962 12222.132 12222.132 "United Kingdom" 1963 12615.21 12615.21 "United Kingdom" 1964 13305.737 13305.737 "United Kingdom" 1965 13562.79 13562.79 "United Kingdom" 1966 13776.563 13776.563 "United Kingdom" 1967 14025.323 14025.323 "United Kingdom" 1968 14550.729 14550.729 "United Kingdom" 1969 14769.816 14769.816 "United Kingdom" 1970 15097.046 15097.046 "United Kingdom" 1971 15271.058 15271.058 "United Kingdom" 1972 15695.372 15695.372 "United Kingdom" 1973 16768.34 16768.34 "United Kingdom" 1974 16233.765 16233.765 "United Kingdom" 1975 15867.37 15867.37 "United Kingdom" 1976 16687.441 16687.441 "United Kingdom" 1977 17517.213 17517.213 "United Kingdom" 1978 18714.9 18714.9 "United Kingdom" 1979 19790.676 19790.676 "United Kingdom" 1980 20040.46 20040.46 "United Kingdom" 1981 19607.59 19607.59 "United Kingdom" 1982 19658.1 19658.1 "United Kingdom" 1983 20098.76 20098.76 "United Kingdom" 1984 20334.07 20334.07 end
Comment