Hello everybody, I have the following dataset
I need to create a new variable that rapresent the mean of REC_over_TOTAL for each country which change every year based on the new observation.
After that I want to create a pie chart which gives me the top 5 countries with the highest mean of REC_over_TOTAL for 2020.
Can someone help me?
Many thanks for the attentio
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int Year str36 Countryoforigin float REC_over_TOTAL 2000 "Afghanistan" .08547009 2000 "Albania" .28148147 2000 "Algeria" 0 2000 "Angola" .6595744 2000 "Egypt" .3333333 2000 "Armenia" .5 2000 "Azerbaijan" .5 2000 "Burundi" 1 2000 "Benin" 1 2000 "Bangladesh" .0909091 2000 "Belarus" . 2000 "Bosnia and Herzegovina" .3703704 2000 "China" 0 2000 "Cameroon" 1 2000 "Congo" .766129 2000 "Dem. Rep. of the Congo" .59302324 2000 "Colombia" .4615385 2000 "Cuba" .3333333 2000 "Ecuador" . 2000 "Eritrea" .7222222 2000 "Ethiopia" .6486486 2000 "Gambia" . 2000 "Palestinian" .2857143 2000 "Georgia" .51724136 2000 "Ghana" .3333333 2000 "Guinea-Bissau" 0 2000 "Guinea" 0 2000 "Croatia" .5 2000 "Cote d'Ivoire" 1 2000 "India" . 2000 "Iran (Islamic Rep. of)" .4243903 2000 "Iraq" .02648305 2000 "Kazakhstan" 1 2000 "Liberia" .5 2000 "Libya" 0 2000 "Lebanon" 0 2000 "Sri Lanka" .17857143 2000 "Mauritania" . 2000 "North Macedonia" 0 2000 "Rep. of Moldova" 0 2000 "Nigeria" 0 2000 "Pakistan" .3030303 2000 "Peru" 1 2000 "Romania" 0 2000 "Russian Federation" .5 2000 "Rwanda" .4137931 2000 "Senegal" 0 2000 "Sierra Leone" .1891892 2000 "Somalia" .11363637 2000 "Serbia and Kosovo: S/RES/1244 (1999)" . 2000 "Viet Nam" 1 2000 "Sudan" .5535714 2000 "Syrian Arab Rep." .10204082 2000 "Togo" 1 2000 "Tunisia" .58064514 2000 "Turkey" .06204583 2000 "Unknown " .04093092 2000 "Ukraine" .5 2000 "Uzbekistan" 0 2001 "Afghanistan" .1784141 2001 "Albania" .14666666 2001 "Algeria" .1851852 2001 "Angola" .6153846 2001 "Egypt" . 2001 "Armenia" . 2001 "Azerbaijan" . 2001 "Burundi" . 2001 "Bangladesh" .18032786 2001 "Belarus" . 2001 "Brazil" . 2001 "Bosnia and Herzegovina" .3333333 2001 "Bulgaria" . 2001 "China" . 2001 "Cameroon" .8148148 2001 "Congo" .8181818 2001 "Dem. Rep. of the Congo" .7657658 2001 "Colombia" .45 2001 "Cuba" . 2001 "Czechia" . 2001 "Ecuador" . 2001 "Eritrea" .4468085 2001 "Ethiopia" .6842105 2001 "Gambia" .5 2001 "Palestinian" .1851852 2001 "Georgia" . 2001 "Ghana" . 2001 "Guinea" . 2001 "Cote d'Ivoire" . 2001 "India" . 2001 "Iran (Islamic Rep. of)" .4917127 2001 "Iraq" .04124836 2001 "Jordan" . 2001 "Kazakhstan" . 2001 "Liberia" . 2001 "Lebanon" .52380955 2001 "Sri Lanka" .08928572 2001 "Mauritania" . 2001 "North Macedonia" 0 2001 "Rep. of Moldova" .13157895 2001 "Morocco" . end
After that I want to create a pie chart which gives me the top 5 countries with the highest mean of REC_over_TOTAL for 2020.
Can someone help me?
Many thanks for the attentio
Comment