Posted on 22 November 2010 by Mitch Abdon
Looking for a certain variable in a dataset with so many variables, even if you yourself have created these variables, can sometimes test your patience. Use -lookfor- to minimize that stress. But, if in the first place you have created variable names and variable labels that do not make sense—for example, v1 with label “variable 1“—you deserve that stress!
-lookfor- is like Ctrl+f in some applications. It helps you find the variables whose names or labels (or a part of their names or labels) match your string search criteria. -lookfor- searches for any match in all variable names and labels in the dataset and returns the list of resulting variable names and their corresponding descriptions. Example:
sysuse census.dta, clear
Notice that -lookfor- is not case sensitive—looking for “pop” is the same as looking for “POP.” Alternately, to look for all occurrences of “pop” or “census,” you may type:
lookfor pop census
See “help lookfor” for more.