* chkdup -- a duplicate value identification program * Marc Jacobs, University of Utrecht, The Netherlands * October 1, 1991 program define chkdup version 2.1 mac def _varlist "req ex min(1) max(1)" parse "%_*" sort %_varlist capture by %_varlist: assert _N==1 if _rc==0 { di in gr "(%_varlist has no duplicate values)" exit } di _n in gr /* */ "duplicate values detected; the following values occur more than once:" confirm new var _DUPCNT capture { by %_varlist: gen long _DUPCNT = _N if _n==1 noisily list %_varlist _DUPCNT if _DUPCNT!=. & _DUPCNT>1, noo } mac def _rc=_rc capture drop _DUPCNT exit %_rc end