-------------------------------------------------------------------------------
help for labmatch
-------------------------------------------------------------------------------

Find observations by label values

labmatch varname stringpattern [ varname stringpattern ... ] [if exp] [, nolist alsolist(varlist) tabulate(varlist) id(varname) ]

labmatch lists observations where the value labels of variables listed match the string pattern given for each. Option nolist suppresses listing observations, and option alsolist requests additional variables to be listed. Option tabulate requests a tabulation of up to two variables for observations that match the criteria specified. Option id returns all values of the specified variable for observations that match the criteria, in r(id), along with a comma-delimited list in r(idcomma) suitable for use with inlist or other functions. The if qualifier needed to list observations (et cetera) is returned in r(cond). Support for in is not provided because it would unnecessarily complicate the returned local cond.

Examples

sysuse nlsw88, clear labmatch race other married marr* collgrad col* occ Sal* ret li

*note that the next example does not find anything because it is looking for > "Sal*," not "Sal*" labmatch race other married marr* collgrad col* occ Sal*, id(idcode) a(idcod > e) *easy solution is to bind the stringpattern in quotes labmatch race other married marr* collgrad col* occ "Sal*", id(idcode) a(idc > ode) *or leave a space before the comma labmatch race other married marr* collgrad col* occ Sal* , id(idcode) a(idco > de)

labmatch race other married marr* occ *ers labmatch race other married marr* occ *ers if _n<1600 labmatch race other married marr* occ "*ers", t(id age) nolist id(idcode) a( > idcode) ret li su i* if inlist(idcode,`r(idcomma)') labmatch race other married marr* occ "*ers", nolist id(idcode) a(idcode) su i* `r(cond)' Author of labmatch

Austin Nichols <austinnichols@gmail.com>

Acknowledgments

This program was suggested by Stefan Gawrich and Daniel Klein.

Also see

On-line: help for mf_st_vlload, labelbook.