Thanks to Kit Baum, the -egenmore- package on SSC has been
updated. -egenmore- is a bundle of functions for -egen- The
collection consists of egen-functions from various authors, and an
integrative help-file maintained by Nick Cox.
The update consists of a single new function, -is03166()-, written by
myself. -iso3166()- maps varname containing "official short country
names" into a new variable containing the ISO 3166-1-alpha-2 code
elements (e.g. DE for "Germany", GB for "United Kingdom" and HM for
"Heard Island and McDonald Islands") and vice versa.
-iso3166()- is especially useful for data from cross-country comparative
surveys. IS0 3166-1-alpha codes works quite well as marker labels in
scatter plots of aggregated statistics.
To install -egenmore- type
. ssc install egenmore
into a net aware Stata, or use -adoupdate-.
Extract from the help file:
iso3166(varname) [, origin(codes|names) language(en|fr) verbose update]
maps varname containing "official short country names" into a new
variable containing the ISO 3166-1-alpha-2 code elements (e.g. DE for
"Germany", GB for "United Kingdom" and HM for "Heard Island and
McDonald Islands") and vice versa. The official short country names
can be in English (default) or French. Correspondingly the function
produces country names from ISO 3166-1-alpha-2 codes in English
or French. (Version 9.2 required.)
origin(codes|names) declares the character of the country variable
that is already in the data. The default is names, meaning that
varname holds the "official short country names". This information
may be stored as a string variable or as a numeric variable that
is labeled accordingly. This default setting produces ISO
3166-1-alpha-2 codes from the country names. If country names
should be produced from the two letter codes, use egen newvar =
iso3166(varname), origin(codes).
language(en|fr) defines the language in which the country names are
stored, or should be produced. language(en) is for English names
(default); language(fr) is for French names.
verbose For the mapping from country names to ISO 3166-1-alpha2 codes
the program expects official short country names. It cannot handle
unofficial country names such as "Great Britain", "Taiwan" or
"Russia". Such unofficial country names result in the generation of
missing values for the respective countries. By default
iso3166() only returns the number of missing values it has
produced. With verbose Stata also provides the list of
unofficial country names in varname and a clickable link to the
list of official country names. This is convenient if one wants
to correct the information stored in varname before using
iso3166(). For the transformation of ISO 3166-1-alpha2 codes
into country names, verbose does something equivalent.
update The ISO 3166-1-alpha2 codes are automaticaly looked up in
information provided by the ISO 3166 Maintenance Agency of the
International Organization for Standardization. The information is
automatically downloaded from the internet when the user specifies
iso3166() the first time, or whenever update is specified. Note:
Updating the matching list regularly will guarantee that
iso3166() always produces up-to-date country names. However,
updating the match list may also produce missing values when
running older do-files for data sets with countries that no
longer exist (for example, Yugoslavia).
Note the implications: This function will only work if your copy of
Stata can access the internet, at least for the first time it is
called. The results of the function might be not fully
reproducible in the future.
Many regards
Uli
--
[email protected]
030 25491-361
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/