Hello Statalist users,

I am working on a dataset which contains the countries of export (in some cases cities of export!) for a set of 4000+ companies. My analysis will needs to be done at a "region of export" and NOT "country of export" or "city of export" level. Hence, I plan to map the countries/ cities to unique regions. For this, I presume I should first obtain a list of unique country/ city values. I can then map them to specific regions and update my original database with the regions of export (in place of country/ city of export.)

My challenge is that the variable for countries of export (GS1) has a very large number of unique values (perhaps > 500.) I have pasted below the result of the levelsof command that I ran on this variable. Is there anyway for me to create a dataset of this levelsof output? (- If so, I can build the country-region mapping for this dataset and then merge it with my original data.) Thank you.


Code:
. levelsof GS1
`"-"' `"ALL Other"' `"ALL Other Asia"' `"ALL Other Countries"' `"ALL Other Foreign Countries"' `"ALL Other International"' `"APAC"' `"Abroad"' `"Africa"' `"Africa, Middl
> e East and Asia"' `"Ahold USA"' `"Alabama"' `"Algeria"' `"All Foreign"' `"All Foreign Countries"' `"All Other"' `"All Other Countries"' `"All Other Foreign"' `"All Oth
> er Foreign Countries"' `"All Other International"' `"America"' `"America's"' `"America-Pacific"' `"Americas"' `"Americas "' `"Americas - U.S."' `"Americas and Europe"'
>  `"Americas, Excluding The United States"' `"Americas, Polynesia"' `"Americas, Principally The US"' `"Angola"' `"Argentina"' `"Arizona"' `"Asia"' `"Asia "' `"Asia - Ot
> her"' `"Asia Pacific"' `"Asia Pacific "' `"Asia Pacific, Japan and Rest of World"' `"Asia and All Others"' `"Asia and Australia"' `"Asia and Other"' `"Asia and Others"
> ' `"Asia and Pacific"' `"Asia, Africa, Middle East, Turkey, Russia, Ukraine and Belarus "' `"Asia, New Caledonia"' `"Asia-Pacific"' `"Asia-Pacific "' `"Asia-Pacific Ex
> cluding China"' `"Asia-Pacific and Japan"' `"Asia-Pacific and Other"' `"Asia-Pacific, excluding Japan "' `"Asia-Pacific/Middle East"' `"Asia/Pacific"' `"Australia"' `"
> Australia Segment"' `"Australia and Hong Kong"' `"Australia and New Zealand"' `"Australia, New Zealand and Other"' `"Australia, New Zealand, Southeast Asia, China "' `
> "Australia/new Zealand"' `"Austria"' `"Bahamas"' `"Barbados"' `"Barbados, Dominica, St. Kitts, and St. Maarten"' `"Barnett"' `"Belarus"' `"Belgium"' `"Bermuda"' `"Boli
> via"' `"Brazil"' `"Buenos Aires"' `"California"' `"Canada"' `"Canada and Mexico"' `"Canada and Other"' `"Canada/Mexico"' `"Canadian Operations"' `"Caribbean"' `"Cayman
>  Islands"' `"Central"' `"Central America"' `"Central America and The Caribbean"' `"Central America, South America and Mexico"' `"Central Europe"' `"Central Europe & Sp
> ain"' `"Central USA Region"' `"Central and Eastern Europe"' `"Central and Eastern Europe "' `"Channel Islands"' `"Chile"' `"China"' `"China "' `"China and Hong Kong"' 
> `"China, Hong Kong, Macau, Taiwan and Singapore"' `"Colombia"' `"Congo"' `"Consolidation Adjustments"' `"Consolidation Elimination"' `"Continental Europe"' `"Corporate
> "' `"Corporate & Other"' `"Corporate and Other"' `"Corporate/Eliminations"' `"Czech Republic"' `"Democratic Republic of Congo"' `"Denmark"' `"Discontinued Operations"'
>  `"EMEA"' `"EMEA "' `"EU Countries"' `"EU and Other International Markets"' `"East/West"' `"Eastern China"' `"Eastern Group"' `"Ecuador"' `"Egypt"' `"Elimination ALL o
> f The Companies"' `"Eliminations"' `"Emerging"' `"Emerging Markets"' `"Europe"' `"Europe "' `"Europe / Middle East / Africa "' `"Europe Excluding Germany"' `"Europe Mi
> ddle East and Africa "' `"Europe and Africa"' `"Europe and Asia"' `"Europe and Israel"' `"Europe and Middle East"' `"Europe and Rest of the World"' `"Europe and The Fo
> rmer Commonwealth of Independent States"' `"Europe, Africa and Middle East"' `"Europe, Africa, Middle East "' `"Europe, Middle East & Africa "' `"Europe, Middle East a
> nd Africa"' `"Europe, Middle East and Africa "' `"Europe, Middle East, Africa"' `"Europe, Middle East, Africa "' `"Europe, Middle East, Africa and India "' `"Europe, M
> iddle East, Africa and Other"' `"Europe, Middle East, and Africa"' `"Europe, Middle East, and Africa "' `"Europe, Other than The United Kingdom"' `"Europe, Primarily N
> orth Sea"' `"Europe, Russia, The Middle East, India and Africa "' `"Europe, The Middle East and Africa"' `"Europe, The Middle East and Africa "' `"Europe, The Middle E
> ast, and Africa"' `"Europe, middle East and Africa"' `"Europe/Africa/CIS"' `"Europe/Asia"' `"European"' `"European Union"' `"Ex-U.S."' `"Export"' `"Far-East"' `"Finlan
> d"' `"Florida"' `"Foreign"' `"Foreign Countries"' `"Foreign Operations"' `"Foreign, Primarily Canada and Australia"' `"France"' `"Gabon"' `"Germany"' `"Ghana"' `"Ghana
>  - Tarkwa"' `"Great Britain"' `"Greater London"' `"Greece"' `"Gulf of Mexico"' `"Guyana"' `"Hong Kong"' `"Hong Kong Special Administrative Region "' `"Hong Kong and PR
> C"' `"Hong Kong, China"' `"Hong Kong, Macau and Taiwan"' `"Hungary"' `"India"' `"Indian Ocean"' `"Indonesia"' `"Inter-Segmental Revenue"' `"Intercompany Sales"' `"Inte
> rnational"' `"International "' `"International - Other"' `"International Operations"' `"International and Other"' `"Ireland"' `"Israel"' `"Italy"' `"Japan"' `"Kazakhst
> an"' `"Korea"' `"Las Vegas"' `"Latin America"' `"Latin America and Asia Pacific"' `"Latin America and The Caribbean "' `"Latin America/Caribbean"' `"Luxembourg"' `"Mac
> au"' `"Mainland China"' `"Mainland China and Hong Kong"' `"Malaysia"' `"Managed, International and Other"' `"Manitoba"' `"Markets outside of The United States"' `"Metr
> opolitan France"' `"Mexico"' `"Mexico Operations"' `"Michigan"' `"Mid-Continent"' `"Middle America"' `"Middle East"' `"Middle East and Africa"' `"Midwest"' `"Mongolia"
> ' `"Morocco"' `"Netherlands"' `"New Zealand"' `"Nigeria"' `"Non-U.S."' `"Non-United States"' `"North America"' `"North America "' `"North America Other Than United Sta
> tes"' `"North America and Latin America "' `"North America, Mainly USA"' `"North America, Primarily The United States"' `"North Asia"' `"North Sea"' `"North and Latin 
> America"' `"North and South America"' `"Northern Europe"' `"Norway"' `"Norway - Discontinued Operations"' `"Not Found"' `"Other"' `"Other Americas"' `"Other Areas"' `"
> Other Asia"' `"Other Asia-Pacific"' `"Other Countries"' `"Other Countries and Regions"' `"Other Europe"' `"Other European Countries"' `"Other Foreign"' `"Other Foreign
>  Countries"' `"Other International"' `"Other Markets"' `"Other Nordic Countries"' `"Other OECD Countries"' `"Other Operations"' `"Other Regions"' `"Others"' `"Others E
> urope"' `"Outside The United States"' `"Outside of North America"' `"Outside of The United States"' `"Outside of the United States"' `"Overseas and Other"' `"PRC"' `"P
> RC "' `"PRC and Hong Kong"' `"PRC, Excluding Hong Kong"' `"PRC, Excluding Hong Kong S.A.R."' `"PRC, Excluding Hong Kong and Macau"' `"Pacific"' `"Pacific - Rim Countri
> es"' `"Pacific Rim"' `"Panama"' `"Papua New Guinea"' `"People's Republic of China"' `"People's Republic of China "' `"Peoples Republic of China"' `"Peoples Republic of
>  China "' `"Peoples’ Republic of China "' `"People’S Republic of China"' `"People’S Republic of China "' `"People’s Republic of China"' `"People’s Republic of China "'
>  `"Peru"' `"Peru - Cerro Corona"' `"Philippines"' `"Portugal"' `"Puerto Rico"' `"Republic of China "' `"Republic of Ireland"' `"Republic of Kazakhstan"' `"Rest of Chin
> a"' `"Rest of Europe"' `"Rest of European Union"' `"Rest of The World"' `"Rest of World"' `"Rest of World – Ireland"' `"Rest of World, Other Eliminations & Corporate"'
>  `"Rest of the World"' `"Rest of the World "' `"Rest-Of-World"' `"Russia"' `"Russian Federation"' `"Segment Adjustment"' `"Singapore"' `"South & Central America"' `"So
> uth Africa"' `"South America"' `"South Korea"' `"Southeast"' `"Southeast Asia"' `"Southern California"' `"Spain"' `"Sweden"' `"Switzerland"' `"Taiwan"' `"Taiwan, Rest 
> of China"' `"Tanzania "' `"Texas"' `"Thailand"' `"The Americas"' `"The Greater China"' `"The Netherlands"' `"The PRC"' `"The People's Republic of China"' `"The People'
> s Republic of China "' `"The People’S Republic of China "' `"The People’s Republic of China "' `"The United States"' `"Turkey"' `"U.K."' `"U.K. & Ireland"' `"U.K. and 
> Channel Islands"' `"U.S"' `"U.S."' `"U.S. and Canada"' `"U.S.A."' `"UAE"' `"UK"' `"UK & Ireland"' `"US and Puerto Rico"' `"USA"' `"Unallocated License Revenue"' `"Unal
> located Other Sales"' `"United Arab Emirates"' `"United Arab Emirates "' `"United Kingdom"' `"United Kingdom "' `"United Kingdom and Europe"' `"United States"' `"Unite
> d States "' `"United States & Canada"' `"United States & North America"' `"United States Operations"' `"United States and Abroad"' `"United States and Canada"' `"Unite
> d States and Canada "' `"United States of America"' `"United States of America "' `"United States, Primarily Gulf of Mexico"' `"Unitedstates"' `"Uruguay"' `"Venezuela"
> ' `"Washington DC"' `"West Africa"' `"West Africa "' `"West Indies/Guyana"' `"West Texas"' `"Western Canada"' `"Western Europe"' `"Western Hemisphere"' `"Yemen"' `"Zim
> babwe"' `"canada"' `"outside The U.S"' `"outside of The United States"' `"outside of The United States "'