Hi Guys Good Morning
in the given data set i want india and china total population
sno | Country (or dependency) | Population |
1 | China | 1420062022 |
2 | India | 1368737513 |
Total_Pop_Both_Countries | 2788799535 |
data world_popl;
input sno Country or dependency$ Population Yearly Net Density Land Area Migrants Fert. Med. Urban World
Change Change (P/Km²) (Km²) (net) Rate Age Pop % Share;
datalines;
1 China 1420062022 0.0035 5016094 151 9388211 -324919 1.6 39 0.6 0.1841
2 India 1368737513 0.0108 14685659 460 2973190 -490000 2.3 28 0.34 0.1774
3 United States 329093110 0.0071 2326362 36 9147420 900000 1.9 38 0.84 0.0427
4 Indonesia 269536482 0.0103 2741502 149 1811570 -165000 2.3 29 0.56 0.0349
5 Brazil 212392717 0.0072 1524763 25 8358140 6000 1.7 33 0.86 0.0275
6 Pakistan 204596442 0.0188 3782624 265 770880 -214356 3.4 23 0.4 0.0265
7 Nigeria 200962417 0.026 5087180 221 910770 -60000 5.4 18 0.52 0.026
8 Bangladesh 168065920 0.0102 1697771 1291 130170 -470000 2.1 27 0.37 0.0218
9 Russia 143895551 -0.0005 -69158 9 16376870 160000 1.8 40 0.73 0.0187
10 Mexico 132328035 0.012 1568961 68 1943950 -60000 2.1 29 0.79 0.0172
11 Japan 126854745 -0.0026 -330587 348 364555 50000 1.5 48 0.94 0.0164
12 Ethiopia 110135635 0.0242 2600753 110 1000000 -12000 4 20 0.21 0.0143
13 Philippines 108106310 0.015 1594236 363 298170 -130000 2.9 25 0.44 0.014
14 Egypt 101168745 0.018 1793004 102 995450 -55000 3.2 25 0.39 0.0131
15 Vietnam 97429061 0.0097 937915 314 310070 -40000 1.9 33 0.36 0.0126
16 DR Congo 86727573 0.0324 2722584 38 2267050 23861 6 17 0.41 0.0112
17 Turkey 82961805 0.0128 1044934 108 769630 305000 2 32 0.72 0.0108
18 Iran 82820766 0.0099 809031 51 1628550 -55000 1.6 32 0.76 0.0107
19 Germany 82438639 0.0018 145182 237 348560 370000 1.5 47 0.76 0.0107
20 Thailand 69306160 0.0018 122987 136 510890 19444 1.5 40 0.54 0.009
21 United Kingdom 66959016 0.0058 385512 277 241930 180000 1.9 41 0.81 0.0087
22 France 65480710 0.0038 247439 120 547557 80000 2 42 0.81 0.0085
23 Tanzania 60913557 0.0308 1822165 69 885800 -40000 4.9 18 0.33 0.0079
24 Italy 59216525 -0.0013 -74444 201 294140 70000 1.5 48 0.72 0.0077
25 South Africa 58065097 0.0116 666676 48 1213090 60000 2.4 27 0.63 0.0075
26 Myanmar 54336138 0.0089 480403 83 653290 -20000 2.2 29 0.37 0.007
27 Kenya 52214791 0.0248 1263912 92 569140 -10000 3.8 20 0.27 0.0068
28 South Korea 51339238 0.0034 174803 528 97230 40000 1.3 43 0.82 0.0067
29 Colombia 49849818 0.0078 385135 45 1109500 -29401 1.8 32 0.81 0.0065
30 Spain 46441049 0.0009 43597 93 498800 40000 1.4 46 0.83 0.006
31 Uganda 45711874 0.0326 1441311 229 199810 -30000 5.5 16 0.17 0.0059
32 Argentina 45101781 0.0092 412917 16 2736690 4800 2.3 32 0.89 0.0058
33 Ukraine 43795220 -0.0049 -213994 76 579320 -20000 1.6 41 0.7 0.0057
34 Algeria 42679018 0.016 670964 18 2381740 -10000 2.6 29 0.74 0.0055
35 Sudan 42514094 0.0242 1002568 24 1765048 -50000 4.4 20 0.36 0.0055
36 Iraq 40412299 0.0273 1072546 93 434320 7834 4.3 20 0.69 0.0052
37 Poland 38028278 -0.002 -76554 124 306230 -10000 1.3 42 0.61 0.0049
38 Canada 37279811 0.0088 326046 4 9093510 220000 1.6 41 0.83 0.0048
39 Afghanistan 37209007 0.023 835831 57 652860 -60000 4.4 19 0.27 0.0048
40 Morocco 36635156 0.0123 443351 82 446300 -51419 2.4 30 0.6 0.0047
41 Saudi Arabia 34140662 0.0175 586319 16 2149690 118000 2.5 32 0.78 0.0044
42 Peru 32933835 0.0117 382020 26 1280000 -35908 2.4 29 0.79 0.0043
43 Uzbekistan 32807368 0.0137 442372 77 425400 -8863 2.2 28 0.35 0.0043
44 Venezuela 32779868 0.0123 398647 37 882050 -12099 2.3 29 0.9 0.0042
45 Malaysia 32454455 0.0129 411997 99 328550 50000 2 30 0.77 0.0042
46 Angola 31787566 0.0329 1013361 25 1246700 0 5.6 17 0.38 0.0041
47 Mozambique 31408823 0.0288 880150 40 786380 -5000 5.1 18 0.32 0.0041
48 Ghana 30096970 0.0215 633327 132 227540 -20000 3.9 21 0.55 0.0039
49 Nepal 29942018 0.0107 317983 209 143350 -70000 2.1 25 0.2 0.0039
50 Yemen 29579986 0.023 664702 56 527970 -30000 3.8 20 0.35 0.0038
51 Madagascar 26969642 0.0269 706832 46 581795 -1500 4.1 20 0.38 0.0035
52 North Korea 25727408 0.0046 116736 214 120410 -2031 1.9 35 0.61 0.0033
53 Côte d'Ivoire 25531083 0.0251 625240 80 318000 6000 4.8 19 0.52 0.0033
54 Cameroon 25312993 0.0257 634759 54 472710 -4800 4.6 19 0.58 0.0033
55 Australia 25088636 0.0128 316389 3 7682300 169993 1.8 38 0.9 0.0033
56 Taiwan 23758247 0.0027 64158 671 35410 30000 1.2 42 0.78 0.0031
57 Niger 23176691 0.0388 865316 18 1266700 -5699 7.2 15 0.19 0.003
58 Sri Lanka 21018859 0.0033 68818 335 62710 -90000 2 34 0.2 0.0027
59 Burkina Faso 20321560 0.0289 569909 74 273600 -25000 5.2 18 0.33 0.0026
60 Malawi 19718743 0.0289 554015 209 94280 -12000 4.5 18 0.17 0.0026
61 Mali 19689140 0.0304 581434 16 1220190 -40000 5.9 16 0.4 0.0026
62 Romania 19483360 -0.005 -97274 85 230170 -30000 1.5 43 0.61 0.0025
63 Kazakhstan 18592970 0.0103 189110 7 2699700 0 2.6 31 0.5 0.0024
64 Syria 18499181 0.0117 214774 101 183630 -248000 2.8 22 0.8 0.0024
65 Chile 18336653 0.0077 139444 25 743532 17057 1.8 35 0.91 0.0024
66 Zambia 18137369 0.03 528191 24 743390 -8000 4.9 18 0.42 0.0024
67 Guatemala 17577842 0.0193 332496 164 107160 -9215 2.9 23 0.54 0.0023
68 Zimbabwe 17297495 0.0227 384234 45 386850 -20000 3.6 20 0.31 0.0022
69 Netherlands 17132908 0.0028 48449 508 33720 16000 1.7 43 0.92 0.0022
70 Ecuador 17100444 0.0141 237019 69 248360 -6155 2.4 28 0.65 0.0022
71 Senegal 16743859 0.0276 449589 87 192530 -19999 4.6 19 0.45 0.0022
72 Cambodia 16482646 0.0146 236917 93 176520 -30000 2.5 26 0.22 0.0021
73 Chad 15814345 0.03 461161 13 1259200 2000 5.8 17 0.22 0.002
74 Somalia 15636171 0.0299 454246 25 627340 -39958 6.1 17 0.33 0.002
75 Guinea 13398180 0.0265 345572 55 245720 -10000 4.7 19 0.4 0.0017
76 South Sudan 13263184 0.0266 344131 22 610952 30000 4.7 19 0.2 0.0017
77 Rwanda 12794412 0.0235 293256 519 24670 -9000 3.8 20 0.35 0.0017
78 Benin 11801595 0.0275 315921 105 112760 -2000 4.9 19 0.47 0.0015
79 Tunisia 11783168 0.0106 123994 76 155360 -4000 2.1 33 0.67 0.0015
80 Burundi 11575964 0.0321 359514 451 25680 4000 5.6 18 0.14 0.0015
81 Belgium 11562784 0.0056 64265 382 30280 48000 1.8 42 0.96 0.0015
82 Cuba 11492046 0.0003 2964 108 106440 -22000 1.7 43 0.75 0.0015
83 Bolivia 11379861 0.0146 164187 11 1083300 -10001 2.8 25 0.72 0.0015
84 Haiti 11242856 0.0117 129911 408 27560 -35000 2.8 24 0.62 0.0015
85 Greece 11124603 -0.0016 -17558 86 128900 9999 1.3 45 0.79 0.0014
86 Dominican Republic 10996774 0.0105 113778 228 48320 -30267 2.4 28 0.83 0.0014
87 Czechia 10630589 0.0005 5339 138 77240 11999 1.6 43 0.75 0.0014
88 Portugal 10254666 -0.0035 -36530 112 91590 -6000 1.2 46 0.68 0.0013
89 Jordan 10069794 0.0168 165992 113 88780 0 3.3 23 0.67 0.0013
90 Sweden 10053135 0.0071 70426 24 410340 40000 1.9 41 0.86 0.0013
91 Azerbaijan 10014575 0.0091 90661 121 82658 0 2 32 0.55 0.0013
92 United Arab Emirates 9682088 0.0147 140473 116 83600 60200 1.7 34 0.93 0.0013
93 Hungary 9655361 -0.0035 -33486 107 90530 6000 1.4 43 0.74 0.0013
94 Honduras 9568688 0.0161 151521 86 111890 -2800 2.4 25 0.54 0.0012
95 Belarus 9433874 -0.0019 -18239 46 202910 2000 1.7 40 0.75 0.0012
96 Tajikistan 9292000 0.0203 184789 66 139960 -20000 3.3 23 0.28 0.0012
97 Austria 8766201 0.0016 14381 106 82409 20000 1.5 44 0.66 0.0011
98 Serbia 8733407 -0.0033 -28620 100 87460 -10000 1.6 41 0.59 0.0011
99 Switzerland 8608259 0.0075 64225 218 39516 50000 1.5 43 0.74 0.0011
100 Papua New Guinea 8586525 0.02 168179 19 452860 -200 3.6 23 0.13 0.0011
101 Israel 8583916 0.0155 131075 397 21640 10000 2.9 31 0.9 0.0011
102 Togo 8186384 0.0245 195458 151 54390 -2000 4.4 19 0.4 0.0011
103 Sierra Leone 7883123 0.0212 163394 109 72180 -4200 4.3 19 0.36 0.001
104 Hong Kong 7490776 0.0083 61889 7134 1050 29308 1.3 45 N.A. 0.001
105 Laos 7064242 0.0148 103032 31 230800 -14704 2.6 24 0.45 0.0009
106 Bulgaria 6988739 -0.0068 -48109 64 108560 -4800 1.6 45 0.74 0.0009
107 Paraguay 6981981 0.0123 85073 18 397300 -16473 2.4 27 0.65 0.0009
108 Libya 6569864 0.0153 98908 4 1759540 -1999 2.2 29 0.81 0.0009
109 El Salvador 6445405 0.0053 33847 311 20720 -40539 2.1 28 0.7 0.0008
110 Nicaragua 6351157 0.0106 66400 53 120340 -21268 2.2 27 0.62 0.0008
111 Kyrgyzstan 6218616 0.014 85684 32 191800 -20000 2.9 26 0.36 0.0008
112 Lebanon 6065922 -0.0045 -27587 593 10230 -30000 1.7 31 0.71 0.0008
113 Turkmenistan 5942561 0.0156 91095 13 469930 -5000 2.8 27 0.49 0.0008
114 Singapore 5868104 0.0132 76203 8383 700 59690 1.3 42 N.A. 0.0008
115 Denmark 5775224 0.0036 20868 136 42430 15200 1.8 42 0.88 0.0007
116 Finland 5561389 0.0034 18872 18 303890 14000 1.8 43 0.84 0.0007
117 Congo 5542197 0.0264 142302 16 341500 -4001 4.6 19 0.62 0.0007
118 Slovakia 5450987 0.0002 1171 113 48088 1000 1.5 41 0.53 0.0007
119 Norway 5400916 0.0089 47553 15 365268 28000 1.8 40 0.81 0.0007
120 Eritrea 5309659 0.0235 121711 53 101000 -10000 4 19 0.35 0.0007
121 State of Palestine 5186790 0.0265 134014 862 6020 -6563 3.9 20 0.74 0.0007
122 Oman 5001875 0.0356 171929 16 309500 121000 2.5 31 0.71 0.0006
123 Costa Rica 4999384 0.0093 46185 98 51060 3277 1.8 34 0.84 0.0006
124 Liberia 4977720 0.0256 124204 52 96320 -5000 4.5 19 0.51 0.0006
125 Ireland 4847139 0.009 43391 70 68890 4699 2 39 0.65 0.0006
126 Central African Republic 4825711 0.0186 88288 8 622980 -30000 4.8 18 0.44 0.0006
127 New Zealand 4792409 0.009 42811 18 263310 14881 2 38 0.86 0.0006
128 Mauritania 4661149 0.0267 121081 5 1030700 5100 4.6 20 0.6 0.0006
129 Kuwait 4248974 0.0124 51846 238 17820 20000 2 34 0.91 0.0006
130 Panama 4226197 0.0153 63579 57 74340 6290 2.5 30 0.68 0.0005
131 Croatia 4140148 -0.0059 -24635 74 55960 -8000 1.4 44 0.61 0.0005
132 Moldova 4029750 -0.0028 -11315 123 32850 -2864 1.2 38 0.38 0.0005
133 Georgia 3904204 -0.0007 -2927 56 69490 -10000 2 39 0.59 0.0005
134 Puerto Rico 3654978 -0.0011 -4029 412 8870 -14000 1.5 38 0.94 0.0005
135 Bosnia and Herzegovina 3501774 -0.0005 -1780 69 51000 -501 1.4 42 0.44 0.0005
136 Uruguay 3482156 0.0036 12605 20 175020 -3000 2 36 0.96 0.0005
137 Mongolia 3166244 0.0142 44472 2 1553560 -3000 2.7 29 0.73 0.0004
138 Albania 2938428 0.0014 4065 107 27400 -8000 1.7 38 0.67 0.0004
139 Armenia 2936706 0.0009 2554 103 28470 -4998 1.6 36 0.64 0.0004
140 Jamaica 2906339 0.0026 7662 268 10830 -18600 2 31 0.55 0.0004
141 Lithuania 2864459 -0.0042 -12016 46 62674 -5000 1.7 43 0.69 0.0004
142 Qatar 2743901 0.0182 49052 236 11610 40000 1.9 32 0.91 0.0004
143 Namibia 2641996 0.0209 54195 3 823290 -447 3.3 22 0.49 0.0003
144 Botswana 2374636 0.0178 41435 4 566730 3000 2.7 26 0.53 0.0003
145 Lesotho 2292682 0.0131 29672 76 30360 -4000 3 22 0.28 0.0003
146 Gambia 2228075 0.0297 64310 220 10120 -2600 5.3 18 0.62 0.0003
147 Gabon 2109099 0.0201 41538 8 257670 1000 3.7 23 0.8 0.0003
148 North Macedonia 2086720 0.0008 1669 83 25220 -1000 1.5 39 0.58 0.0003
149 Slovenia 2081900 0.0003 640 103 20140 1200 1.6 45 0.5 0.0003
150 Guinea-Bissau 1953723 0.0244 46455 69 28120 -1999 4.5 19 0.52 0.0003
151 Latvia 1911108 -0.0098 -18830 31 62200 -10000 1.6 44 0.7 0.0002
152 Bahrain 1637896 0.0452 70903 2155 760 47000 2 32 0.79 0.0002
153 Swaziland 1415414 0.0173 24029 82 17200 -2000 3 21 0.2 0.0002
154 Trinidad and Tobago 1375443 0.0021 2845 268 5130 -900 1.7 36 0.08 0.0002
155 Equatorial Guinea 1360104 0.0352 46210 48 28050 16000 4.6 22 0.27 0.0002
156 Timor-Leste 1352360 0.0213 28266 91 14870 -10001 5.3 18 0.33 0.0002
157 Estonia 1303798 -0.0023 -2990 31 42390 -1000 1.7 43 0.65 0.0002
158 Mauritius 1271368 0.0024 3053 626 2030 0 1.4 37 0.39 0.0002
159 Cyprus 1198427 0.0079 9342 130 9240 5000 1.3 37 0.67 0.0002
160 Djibouti 985690 0.0147 14282 43 23180 900 2.8 25 0.75 0.0001
161 Fiji 918757 0.0071 6516 50 18270 -4000 2.5 29 0.55 0.0001
162 Réunion 889918 0.0076 6671 356 2500 -1256 2.3 36 N.A. 0.0001
163 Comoros 850910 0.0223 18563 457 1861 -2000 4.2 20 0.29 0.0001
164 Bhutan 826229 0.0112 9175 22 38117 0 2 29 0.41 0.0001
165 Guyana 786508 0.0055 4283 4 196850 -4910 2.5 26 0.3 0.0001
166 Macao 642090 0.0153 9672 21403 30 5000 1.3 39 0.96 0.0001
167 Solomon Islands 635254 0.0192 11973 23 27990 -2400 3.8 21 0.24 0.0001
168 Montenegro 629355 0.0002 136 47 13450 -480 1.7 39 0.64 0.0001
169 Luxembourg 596992 0.0113 6671 230 2590 5000 1.6 40 0.87 0.0001
170 Western Sahara 582478 0.0265 15057 2 266000 5582 2.4 28 0.95 0.0001
171 Suriname 573085 0.0084 4784 4 156000 -1000 2.3 30 0.65 0.0001
172 Cabo Verde 560349 0.0127 7014 139 4030 -1478 2.3 26 0.64 0.0001
173 Micronesia 536579 0.0086 4583 767 700 -3093 2.8 27 0.68 0.0001
174 Maldives 451738 0.0168 7479 1506 300 1952 2 31 0.42 0.0001
175 Guadeloupe 448798 -0.0008 -375 266 1690 -1600 1.9 43 N.A. 0.0001
176 Brunei 439336 0.0121 5260 83 5270 352 1.8 32 0.8 0.0001
177 Malta 433245 0.0027 1156 1354 320 900 1.5 42 0.96 0.0001
178 Bahamas 403095 0.0095 3810 40 10010 1000 1.8 34 0.84 0.0001
179 Belize 390231 0.0204 7787 17 22810 1366 2.5 25 0.42 0.0001
180 Martinique 385320 0.0007 255 364 1060 -960 1.9 46 0.94 0
181 Iceland 340566 0.0082 2786 3 100250 380 1.9 37 0.97 0
182 French Guiana 296847 0.0244 7084 4 82200 1200 3.3 25 0.83 0
183 French Polynesia 288506 0.0093 2647 79 3660 -100 2 33 0.57 0
184 Vanuatu 288017 0.0209 5900 24 12190 121 3.2 23 0.27 0
185 Barbados 287010 0.0022 622 667 430 414 1.8 40 0.32 0
186 New Caledonia 283376 0.0127 3555 16 18280 1133 2.1 33 0.7 0
187 Mayotte 266380 0.0258 6698 710 375 0 3.7 20 0.44 0
188 Sao Tome & Principe 213379 0.0218 4561 222 960 -1000 4.4 19 0.7 0
189 Samoa 198909 0.0061 1214 70 2830 -2500 3.9 22 0.19 0
190 Saint Lucia 180454 0.0044 787 296 610 8 1.4 35 0.2 0
191 Guam 167245 0.0092 1527 310 540 -506 2.3 31 N.A. 0
192 Channel Islands 166828 0.0045 745 878 190 731 1.5 44 0.32 0
193 Curaçao 162547 0.006 970 366 444 515 2 42 0.93 0
194 Kiribati 120428 0.017 2014 149 810 -425 3.6 23 0.42 0
195 St. Vincent & Grenadines 110488 0.0026 288 283 390 -599 1.9 32 0.51 0
196 Tonga 110041 0.0095 1033 153 720 -967 3.6 22 0.24 0
197 Grenada 108825 0.0045 486 320 340 -699 2.1 29 0.36 0
198 Aruba 106053 0.0036 383 589 180 201 1.8 41 0.4 0
199 U.S. Virgin Islands 104909 0 -5 300 350 -451 2.2 42 0.98 0
200 Antigua and Barbuda 104084 0.01 1034 237 440 -11 2 32 0.21 0
201 Seychelles 95702 0.0049 467 208 460 -200 2.3 36 0.55 0
202 Isle of Man 85369 0.0063 538 150 570 N.A. N.A. 0.55 0
203 Andorra 77072 0.0015 119 164 470 N.A. N.A. 0.9 0
204 Dominica 74679 0.005 371 100 750 N.A. N.A. 0.7 0
205 Cayman Islands 63129 0.0125 781 263 240 N.A. N.A. 0.99 0
206 Bermuda 60833 -0.0039 -237 1217 50 N.A. N.A. N.A. 0
207 Greenland 56673 0.0019 108 0 410450 N.A. N.A. 0.88 0
208 Saint Kitts & Nevis 56345 0.0089 495 217 260 N.A. N.A. 0.33 0
209 American Samoa 55727 0.0009 48 279 200 N.A. N.A. 0.89 0
210 Northern Mariana Islands 55246 0.0009 52 120 460 N.A. N.A. 0.9 0
211 Marshall Islands 53211 0.0008 44 296 180 N.A. N.A. 0.76 0
212 Faeroe Islands 49692 0.0041 203 36 1396 N.A. N.A. 0.43 0
213 Sint Maarten 40939 0.0095 387 1204 34 N.A. N.A. N.A. 0
214 Monaco 39102 0.0053 205 26243 1 N.A. N.A. N.A. 0
215 Liechtenstein 38404 0.0065 249 240 160 N.A. N.A. 0.14 0
216 Turks and Caicos 36461 0.0138 498 38 950 N.A. N.A. 0.93 0
217 Gibraltar 34879 0.0042 146 3488 10 N.A. N.A. 0.84 0
218 San Marino 33683 0.0038 126 561 60 N.A. N.A. 0.9 0
219 British Virgin Islands 32206 0.0154 487 215 150 N.A. N.A. 0.44 0
220 Caribbean Netherlands 25971 0.0105 269 79 328 N.A. N.A. 0.61 0
221 Palau 22206 0.011 242 48 460 N.A. N.A. 0.89 0
222 Cook Islands 17462 0.0029 51 73 240 N.A. N.A. 0.92 0
223 Anguilla 15174 0.0086 129 169 90 N.A. N.A. 1 0
224 Wallis & Futuna 11617 -0.0056 -66 83 140 N.A. N.A. 0 0
225 Tuvalu 11393 0.0094 106 380 30 N.A. N.A. 0.56 0
226 Nauru 11260 -0.0046 -52 563 20 N.A. N.A. 0.92 0
227 Saint Pierre & Miquelon 6375 0.0052 33 28 230 N.A. N.A. 0.86 0
228 Montserrat 5220 0.0033 17 52 100 N.A. N.A. 0.09 0
229 Saint Helena 4096 0.0054 22 11 390 N.A. N.A. 0.41 0
230 Falkland Islands 2921 -0.0003 -1 0 12170 N.A. N.A. 0.82 0
231 Niue 1628 0.0025 4 6 260 N.A. N.A. 0.33 0
232 Tokelau 1340 0.0159 21 134 10 N.A. N.A. 0 0
233 Holy See 799 -0.0025 -2 1998 0 N.A. N.A. N.A. 0
;
run;
In SQL:
select sum(population) as sum_pop from world_popl
where country in ('China','India');
Good Morning sir
I want report output below format can we do this output in data setp and proc sql and proc report
sno | Country (or dependency) | Population |
1 | China | 1420062022 |
2 | India | 1368737513 |
2788799535 |
Yes, you can. Show what you have tried already in the different methods.
data dsn;
set country;
by Country__or_dependency_;
retain total 0;
if first.Country__or_dependency_=1 then total=population;
else total=total+population;
if last.Country__or_dependency_=1 ;
/*total=total+population;*/
run;
proc report data =country ;
column Country__or_dependency_ Population;
define Country__or_dependency_ /display;
define Population / sum format= comma32.;
compute population ;
if Country in ("India ,China") then total_pop=populaion1 ;
endcomp;
run;
PS test your example data code before posting; by now you should be able to get a simple data step with datalines right.
PROC PRINT will do subtotals and totals for you
data world_popl; input sno Country $ 3-16 Population; datalines; 1 China 1420062022 2 India 1368737513 3 United States 329093110 ; run; proc print data=world_popl; var sno Country Population; sum Population; where Country in ("China" "India"); run;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.