I have the following dataset for a number of countries.
I would like to generate an aggregate entry (call it africa under variable "country") which is a sum of all the values of the variable "ca" for all the countries by year.
I cannot figure out how to do it except doing it manually in Excel which is obviously not handy.
Can some help me:
Should I need to clarify my question, please let me know.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int year float index str87 country float ca 1980 15 "Algeria" 61248.55 1981 15 "Algeria" 63086 1982 15 "Algeria" 67123.51 1983 15 "Algeria" 70748.18 1984 15 "Algeria" 74710.08 1985 15 "Algeria" 77474.35 1986 15 "Algeria" 77784.24 1987 15 "Algeria" 77239.76 1988 15 "Algeria" 76467.36 1989 15 "Algeria" 79831.92 1980 39 "Benin" 1860.74 1981 39 "Benin" 1965.387 1982 39 "Benin" 2177.307 1983 39 "Benin" 2082.683 1984 39 "Benin" 2247.842 1985 39 "Benin" 2417.076 1986 39 "Benin" 2469.006 1987 39 "Benin" 2431.971 1988 39 "Benin" 2505.768 1989 39 "Benin" 2488.038 1980 1 "Botswana" 1516.087 1981 1 "Botswana" 1694.112 1982 1 "Botswana" 1837.036 1983 1 "Botswana" 2055.612 1984 1 "Botswana" 2335.366 1985 1 "Botswana" 2550.895 1986 1 "Botswana" 2738.062 1987 1 "Botswana" 2963.26 1988 1 "Botswana" 3325.464 1989 1 "Botswana" 4431.94 1980 14 "Burkina Faso" 2192.041 1981 14 "Burkina Faso" 2288.216 1982 14 "Burkina Faso" 2339.263 1983 14 "Burkina Faso" 2311.912 1984 14 "Burkina Faso" 2349.373 1985 14 "Burkina Faso" 2656.291 1986 14 "Burkina Faso" 2867.462 1987 14 "Burkina Faso" 2860.642 1988 14 "Burkina Faso" 3026.523 1989 14 "Burkina Faso" 3091.73 1980 30 "Burundi" 1344.64 1981 30 "Burundi" 1491.376 1982 30 "Burundi" 1484.951 1983 30 "Burundi" 1531.115 1984 30 "Burundi" 1529.591 1985 30 "Burundi" 1708.338 1986 30 "Burundi" 1773.586 1987 30 "Burundi" 1846.2 1988 30 "Burundi" 1936.524 1989 30 "Burundi" 1965.25 1980 2 "Cabo Verde" 278.052 1981 2 "Cabo Verde" 301.547 1982 2 "Cabo Verde" 310.067 1983 2 "Cabo Verde" 339.59 1984 2 "Cabo Verde" 352.435 1985 2 "Cabo Verde" 382.893 1986 2 "Cabo Verde" 393.889 1987 2 "Cabo Verde" 410.86 1988 2 "Cabo Verde" 435.498 1989 2 "Cabo Verde" 460.317 1980 3 "Cameroon" 12794.186 1981 3 "Cameroon" 13726.994 1982 3 "Cameroon" 14749.424 1983 3 "Cameroon" 15988.812 1984 3 "Cameroon" 17275.252 1985 3 "Cameroon" 17681.533 1986 3 "Cameroon" 16752.086 1987 3 "Cameroon" 15813.303 1988 3 "Cameroon" 15216.575 1989 3 "Cameroon" 14737.848 1980 35 "Central African Republic" 1490.16 1981 35 "Central African Republic" 1513.225 1982 35 "Central African Republic" 1540.405 1983 35 "Central African Republic" 1446.484 1984 35 "Central African Republic" 1550.996 1985 35 "Central African Republic" 1602.746 1986 35 "Central African Republic" 1660.092 1987 35 "Central African Republic" 1578.233 1988 35 "Central African Republic" 1611.128 1989 35 "Central African Republic" 1651.01 1980 31 "Comoros" 421.845 1981 31 "Comoros" 438.149 1982 31 "Comoros" 466.119 1983 31 "Comoros" 488.591 1984 31 "Comoros" 508.673 1985 31 "Comoros" 518.847 1986 31 "Comoros" 529.224 1987 31 "Comoros" 537.892 1988 31 "Comoros" 552.348 1989 31 "Comoros" 543.308 1980 16 "Congo" 3243.096 1981 16 "Congo" 3931.224 1982 16 "Congo" 4857.743 1983 16 "Congo" 5130.247 1984 16 "Congo" 5500.578 1985 16 "Congo" 5437.178 1986 16 "Congo" 5062.998 1987 16 "Congo" 5072.587 1988 16 "Congo" 5162.182 1989 16 "Congo" 5253.278 end
0 Response to How to create an aggregate observational unit by adding values by country and year.
Post a Comment