Thanks to Kit Baum a new version of the lookfor2 package is now available on SSC. lookfor2 is a command that allows you to search for a variable in your dataset; it searches for the text you specify in the variable names, variable labels, value labels, and notes (the official lookfor command only searches in the variables names and labels). For example:
The new version also includes the command closedesc. It describes the variables that are close (in terms of the order of variables in the dataset) to a variable you specify. In most datasets I deal with, the variables are grouped together by topic. So if I find one variable that interests me, it often helps to look at the variables around that variable. It is like finding a book in a library; once you found it, it is often very useful to also quickly scan the other books on the same shelf. Here is an example:
Code:
. sysuse nlsw88, clear
(NLSW, 1988 extract)
. lookfor farmers
. lookfor2 farmers
Variable Storage Display Value
name type format label Variable label
---------------------------------------------------------------------------------------------------------------------------
occupation byte %22.0g occlbl Occupation
Code:
. closedesc smsa
Variable Storage Display Value
name type format label Variable label
---------------------------------------------------------------------------------------------------------------------------
grade byte %8.0g Current grade completed
collgrad byte %16.0g gradlbl College graduate
south byte %9.0g southlbl Lives in the south
smsa byte %9.0g smsalbl Lives in SMSA
c_city byte %16.0g ccitylbl Lives in a central city
industry byte %23.0g indlbl Industry
occupation byte %22.0g occlbl Occupation
