Dataset A
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str20(reporter partner) double import int year "Albania" "Argentina" 515256 2019 "Albania" "Australia" 243387 2019 "Albania" "Austria" 4070764 2019 "Albania" "Bahrain" 400 2019 "Albania" "Bangladesh" 653907 2019 "Albania" "Belgium" 2439898 2019 "Albania" "Brazil" 5157799 2019 "Albania" "Bulgaria" 4492959 2019 "Albania" "Cambodia" 228032 2019 "Albania" "Cameroon" 45297 2019 "Albania" "Canada" 3393615 2019 "Albania" "Chile" 3844 2019 "Albania" "China" 45867296 2019 "Albania" "Colombia" 3427729 2019 "Albania" "Costa Rica" 69864 2019 "Albania" "Croatia, Rep. of" 4308223 2019 "Albania" "Cyprus" 75552 2019 "Albania" "Czech Rep." 5715907 2019 "Albania" "Denmark" 711316 2019 "Albania" "Egypt" 3067760 2019 "Albania" "Finland" 972839 2019 "Albania" "France" 6724754 2019 "Albania" "Germany" 26218870 2019 "Albania" "Greece" 36231564 2019 "Albania" "Greenland" 498771 2019 "Albania" "Hong Kong" 202057 2019 "Albania" "Hungary" 3770876 2019 "Albania" "Iceland" 103 2019 "Albania" "India" 3752246 2019 "Albania" "Indonesia" 1287032 2019 "Albania" "Iran" 169407 2019 "Albania" "Iraq" 28564 2019 "Albania" "Ireland" 1270395 2019 "Albania" "Israel" 5164563 2019 "Albania" "Italy" 101123701 2019 "Albania" "Japan" 1325641 2019 "Albania" "Jordan" 37307 2019 "Albania" "Kenya" 106517 2019 "Albania" "Kuwait" 5607 2019 "Albania" "Lithuania" 520594 2019 "Albania" "Luxembourg" 37569 2019 "Albania" "Malaysia" 779891 2019 "Albania" "Mauritius" 31204 2019 "Albania" "Mexico" 625250 2019 "Albania" "Morocco" 176254 2019 "Albania" "Netherlands, The" 4212582 2019 "Albania" "New Zealand" 1273 2019 "Albania" "Nigeria" 101085 2019 "Albania" "Norway" 648814 2019 "Albania" "Pakistan" 1018572 2019 "Albania" "Panama" 0 2019 "Albania" "Paraguay" 47577 2019 "Albania" "Peru" 154590 2019 "Albania" "Philippines" 57933 2019 "Albania" "Poland, Rep. of" 6135012 2019 "Albania" "Portugal" 821642 2019 "Albania" "Qatar" 231825 2019 "Albania" "Romania" 3265392 2019 "Albania" "Russian Federation" 10036688 2019 "Albania" "Saudi Arabia" 27167 2019 "Albania" "Serbia, Rep. of" 14200179 2019 "Albania" "Sierra Leone" 3814 2019 "Albania" "Singapore" 6700 2019 "Albania" "Slovak Rep." 702780 2019 "Albania" "Slovenia, Rep. of" 10444300 2019 "Albania" "South Africa" 136819 2019 "Albania" "South Korea" 1617098 2019 "Albania" "Spain" 4673846 2019 "Albania" "Sri Lanka" 265608 2019 "Albania" "Sweden" 711592 2019 "Albania" "Switzerland" 14513361 2019 "Albania" "Taiwan" 645289 2019 "Albania" "Thailand" 927471 2019 "Albania" "Tunisia" 1280895 2019 "Albania" "Turkey" 35528918 2019 "Albania" "Uganda" 15271 2019 "Albania" "Ukraine" 4250674 2019 "Albania" "United Arab Emirates" 17129 2019 "Albania" "United Kingdom" 3322489 2019 "Albania" "United States" 8260812 2019 "Albania" "Venezuela" 10681 2019 "Albania" "Vietnam" 1865398 2019 "Algeria" "Albania" 5720 2019 "Algeria" "Angola" 9576 2019 "Algeria" "Argentina" 90107125 2019 "Algeria" "Australia" 190070 2019 "Algeria" "Austria" 27912946 2019 "Algeria" "Bahrain" 1844807 2019 "Algeria" "Bangladesh" 1456613 2019 "Algeria" "Belgium" 36570747 2019 "Algeria" "Brazil" 50796873 2019 "Algeria" "Bulgaria" 5689167 2019 "Algeria" "Cambodia" 590320 2019 "Algeria" "Cameroon" 670926 2019 "Algeria" "Canada" 18572061 2019 "Algeria" "Chile" 380512 2019 "Algeria" "China" 518205282 2019 "Algeria" "Colombia" 163860 2019 "Algeria" "Costa Rica" 76043 2019 "Algeria" "Croatia, Rep. of" 4332027 2019 end
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str40 reporter str42 partner double import float year "Albania" "Advanced Economies" 312497189 2019 "Albania" "Advanced Economies" 201028905 2019 "Albania" "Advanced Economies" 261178953 2019 "Albania" "Africa" 2325741 2019 "Albania" "Africa" 2782719 2019 "Albania" "Africa" 4857234 2019 "Albania" "Algeria" 1807390 2019 "Albania" "Algeria" 1510581 2019 "Albania" "Algeria" 1369995 2019 "Albania" "Antigua and Barbuda" 62 2019 "Albania" "Antigua and Barbuda" 74 2019 "Albania" "Antigua and Barbuda" 447646 2019 "Albania" "Argentina" 1027521 2019 "Albania" "Argentina" 815640 2019 "Albania" "Argentina" 858781 2019 "Albania" "Australia" 282861 2019 "Albania" "Australia" 40745 2019 "Albania" "Australia" 338440 2019 "Albania" "Austria" 4004822 2019 "Albania" "Austria" 4791717 2019 "Albania" "Austria" 3984711 2019 "Albania" "Azerbaijan, Rep. of" 6999 2019 "Albania" "Bahrain, Kingdom of" . 2019 "Albania" "Bangladesh" 23529 2019 "Albania" "Bangladesh" 520849 2019 "Albania" "Bangladesh" 623189 2019 "Albania" "Belarus, Rep. of" 51160 2019 "Albania" "Belarus, Rep. of" 16541 2019 "Albania" "Belarus, Rep. of" 61212 2019 "Albania" "Belgium" 4005557 2019 "Albania" "Belgium" 3347765 2019 "Albania" "Belgium" 3558505 2019 "Albania" "Bolivia" 2260 2019 "Albania" "Bolivia" 1222 2019 "Albania" "Bolivia" 2703 2019 "Albania" "Bosnia and Herzegovina" 1878627 2019 "Albania" "Bosnia and Herzegovina" 2247752 2019 "Albania" "Bosnia and Herzegovina" 1622352 2019 "Albania" "Brazil" 3207452 2019 "Albania" "Brazil" 2352098 2019 "Albania" "Brazil" 1965837 2019 "Albania" "Bulgaria" 5100845 2019 "Albania" "Bulgaria" 5279264 2019 "Albania" "Bulgaria" 6103094 2019 "Albania" "Cambodia" 250155 2019 "Albania" "Cambodia" 2493 2019 "Albania" "Cambodia" 299307 2019 "Albania" "Cameroon" 53497 2019 "Albania" "Cameroon" 44712 2019 "Albania" "Cameroon" 41696 2019 "Albania" "Canada" 5997194 2019 "Albania" "Canada" 3317402 2019 "Albania" "Canada" 2772619 2019 "Albania" "Chile" 109403 2019 "Albania" "Chile" 70864 2019 "Albania" "Chile" 130899 2019 "Albania" "China" 50511440 2019 "Albania" "China" 28918088 2019 "Albania" "China" 42216460 2019 "Albania" "China, P.R.: Macao" 3742 2019 "Albania" "China, P.R.: Macao" 4478 2019 "Albania" "Colombia" 261384 2019 "Albania" "Colombia" 277623 2019 "Albania" "Colombia" 218459 2019 "Albania" "Congo, Dem. Rep. of the" 51263 2019 "Albania" "Congo, Dem. Rep. of the" 61335 2019 "Albania" "Costa Rica" 49926 2019 "Albania" "Costa Rica" 59735 2019 "Albania" "Costa Rica" 148829 2019 "Albania" "Croatia, Rep. of" 5025324 2019 "Albania" "Croatia, Rep. of" 6181352 2019 "Albania" "Croatia, Rep. of" 5166251 2019 "Albania" "Cuba" 423 2019 "Albania" "Cuba" 506 2019 "Albania" "Cyprus" 87233 2019 "Albania" "Cyprus" 104373 2019 "Albania" "Cyprus" 471599 2019 "Albania" "Czech Rep." 4687524 2019 "Albania" "Czech Rep." 3935415 2019 "Albania" "Czech Rep." 3917740 2019 "Albania" "Côte d'Ivoire" . 2019 "Albania" "Côte d'Ivoire" . 2019 "Albania" "Côte d'Ivoire" 11059 2019 "Albania" "Denmark" 978386 2019 "Albania" "Denmark" 1446774 2019 "Albania" "Denmark" 1209185 2019 "Albania" "Dominican Rep." 11869 2019 "Albania" "Dominican Rep." 14201 2019 "Albania" "Dominican Rep." 5096 2019 "Albania" "Ecuador" 3735312 2019 "Albania" "Ecuador" 2943260 2019 "Albania" "Ecuador" 3521572 2019 "Albania" "Egypt" 978088 2019 "Albania" "Egypt" 2966472 2019 "Albania" "Egypt" 1170269 2019 "Albania" "Emerging and Developing Asia" 61863154 2019 "Albania" "Emerging and Developing Asia" 51703998 2019 "Albania" "Emerging and Developing Asia" 36319937 2019 "Albania" "Emerging and Developing Economies" 162389109 2019 "Albania" "Emerging and Developing Economies" 222863859 2019 end
As you can see, there are observations in Dataset B not available in Dataset A. I want to combine these two dataset such that only the observations (in this case countries) in Dataset A are kept. The countries that are in Dataset A are kept. The rest of the observations are dropped. I am doing it manually using the
Code:
drop if reporter == "" | partner ==""
0 Response to Combining two datasets and keeping specific observations
Post a Comment