Good day Statalists,

I have a panel data for hundreds countries in dozens years. Now I want to extract data of some countries in a certain year. I don't want to state a condition - if country="xx1" | country=="xx2"| .....- because it is too long and not easy for edit if I want to choose other countries. Thus, I decide to make a loops and I will explain as follow

Data set:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str48 country int year long var49
"ASIA"               2000          .
"ASIA"               2005          .
"ASIA"               2010          .
"ASIA"               2016          .
"Australia"          2000   19153000
"Australia"          2005   20394800
"Australia"          2010   22031750
"Australia"          2016   24210809
"Brazil"             2000  175287587
"Brazil"             2005  186917361
"Brazil"             2010  196796269
"Brazil"             2016  207652865
"Chile"              2000   15262754
"Chile"              2005   16147064
"Chile"              2010   16993354
"Chile"              2016   17909754
"China"              2000 1262645000
"China"              2005 1303720000
"China"              2010 1337705000
"China"              2016 1378665000
"France"             2000   60912500
"France"             2005   63179351
"France"             2010   65027507
"France"             2016   66859768
"Germany"            2000   82211508
"Germany"            2005   82469422
"Germany"            2010   81776930
"Germany"            2016   82348669
"Indonesia"          2000  211540429
"Indonesia"          2005  226712730
"Indonesia"          2010  242524123
"Indonesia"          2016  261115456
"Japan"              2000  126843000
"Japan"              2005  127773000
"Japan"              2010  128070000
"Japan"              2016  126994511
"Korea, Rep."        2000   47008111
"Korea, Rep."        2005   48184561
"Korea, Rep."        2010   49554112
"Korea, Rep."        2016   51245707
"Malaysia"           2000   23185608
"Malaysia"           2005   25659393
"Malaysia"           2010   28112289
"Malaysia"           2016   31187265
"Mexico"             2000  101719673
"Mexico"             2005  108472228
"Mexico"             2010  117318941
"Mexico"             2016  127540423
"Myanmar"            2000   46095462
"Myanmar"            2005   48482614
"Myanmar"            2010   50155896
"Myanmar"            2016   52885223
"Philippines"        2000   77991569
"Philippines"        2005   86274237
"Philippines"        2010   93726624
"Philippines"        2016  103320222
"Russian Federation" 2000  146596557
"Russian Federation" 2005  143518523
"Russian Federation" 2010  142849449
"Russian Federation" 2016  144342396
"Singapore"          2000    4027887
"Singapore"          2005    4265762
"Singapore"          2010    5076732
"Singapore"          2016    5607283
"Thailand"           2000   62958021
"Thailand"           2005   65425470
"Thailand"           2010   67208808
"Thailand"           2016   68863514
"United Kingdom"     2000   58892514
"United Kingdom"     2005   60401206
"United Kingdom"     2010   62766365
"United Kingdom"     2016   65595565
"United States"      2000  282162411
"United States"      2005  295516599
"United States"      2010  309338421
"United States"      2016  323405935
"Vietnam"            2000   80285562
"Vietnam"            2005   84308843
"Vietnam"            2010   88472512
"Vietnam"            2016   94569072
"WORLD"              2000          .
"WORLD"              2005          .
"WORLD"              2010          .
"WORLD"              2016          .
"Afghanistan"        1960    8996351
"Afghanistan"        1961    9166764
"Afghanistan"        1962    9345868
"Afghanistan"        1963    9533954
"Afghanistan"        1964    9731361
"Afghanistan"        1965    9938414
"Afghanistan"        1966   10152331
"Afghanistan"        1967   10372630
"Afghanistan"        1968   10604346
"Afghanistan"        1969   10854428
"Afghanistan"        1970   11126123
"Afghanistan"        1971   11417825
"Afghanistan"        1972   11721940
"Afghanistan"        1973   12027822
"Afghanistan"        1974   12321541
"Afghanistan"        1975   12590286
end
Command of loops:
Code:
local countries "Brazil" "Chile" "United Kingdom" "United States" "Russian Federation" "Philippines" "Malaysia" "Korea, Rep." "China" "Australia" "France" "Germany" "Indonesia" "Myanmar" "Thailand" "Vietnam" "Singapore"
local list ""
foreach i of local countries {
    local list `list' country=="`i'" |
    }
br var49 if year==2015 & (`list')
This command seems working well for countries have 1 word, but not for countries have space in its name such as "United Kingdom".
Do you have any suggestion how to solve it? Or do you have better idea in this case.

Thank you!