namecheck -- Utility to generate Excel list of name mismatches

Syntax

namecheck namevar

Description

namecheck compares the text in namevar with the text in the same variable in an existing file names.dta in the same directory.
You first need to create names.dta.
namecheck creates an Excel file (namelist.xlsx) with unmatched names and generates an error code stopping .do file execution.
Column A is unmatched names from names.dta; column B is unmatched names from the data in memory.
namecheck is useful to compare names (e.g., country names) across data sources to standardize them prior to merging datasets.

names.dta must include only one variable with a variable named varname.
For example, names.dta might be derived from the World Bank's WDI data with the one variable "countryname".
You might have data from another source and want to merge it with WDI data.
To do this, you need to first standardize on the country names the WDI uses.

Example

Setup: Create names.dta file for comparison

. ssc install wbopendata

. wbopendata, indicator(SP.POP.TOTL) long clear

. drop if region=="NA" | region==""

. keep countryname

. duplicates drop

. sort countryname

. save names, replace

Application: Compare with other names

. sysuse lifeexp, clear

. rename country countryname

. namecheck countryname

Author

Christopher Kilby, Villanova University, USA
christopher.kilby@villanova.edu