A standard task in data management is producing a list of variable names showing which variables have specific properties, such as being of string type, or having value labels attached, or having a date format. A first-principles strategy is to loop over variables, checking one by one which have the property or properties concerned. I discuss this strategy in detail with a variety of examples. A canned alternative is offered by the official command ds or by a new command, findname, published formally with this column.
Anonymous. 1992. dm67.1: Short describes, finding variables, and codebooks. Stata Technical Bulletin8: 3–5. Reprinted in Stata Technical Bulletin Reprints, vol. 2, pp. 11–14. College Station, TX: Stata Press.
2.
CoxN. J.1999. dm67: Numbers of missing and present values. Stata Technical Bulletin49: 7–8. Reprinted in Stata Technical Bulletin Reprints, vol. 9, pp. 26–27. College Station, TX: Stata Press.
3.
CoxN. J.2000. dm78: Describing variables in memory. Stata Technical Bulletin56: 2–4. Reprinted in Stata Technical Bulletin Reprints, vol. 10, pp. 15–17. College Station, TX: Stata Press.
4.
CoxN. J.2001a. dm67.1: Enhancements to numbers of missing and present values. Stata Technical Bulletin60: 2–3. Reprinted in Stata Technical Bulletin Reprints, vol. 10, pp. 7–9. College Station, TX: Stata Press.
5.
CoxN. J.2001b. dm78.1: Describing variables in memory: update to Stata 7. Stata Technical Bulletin60: 3. Reprinted in Stata Technical Bulletin Reprints, vol. 10, p. 17. College Station, TX: Stata Press.
6.
CoxN. J.2002. Speaking Stata: How to face lists with fortitude. Stata Journal2: 202–222.
7.
CoxN. J.2003a. Software update for nmissing and npresent. Stata Journal3: 349.
8.
CoxN. J.2003b. Stata tip 2: Building with floors and ceilings. Stata Journal3: 446–447.
9.
CoxN. J.2005. Software update for nmissing and npresent. Stata Journal5: 607.
10.
CoxN. J.2007a. Speaking Stata: Counting groups, especially panels. Stata Journal7: 571–581.
11.
CoxN. J.2007b. Speaking Stata: Making it count. Stata Journal7: 117–130.
12.
CoxN. J.2007c. Stata tip 50: Efficient use of summarize. Stata Journal7: 438–439.
13.
CoxN. J.2007d. Stata tip 51: Events in intervals. Stata Journal7: 440–443.
14.
RisingB.2010. Stata tip 86: The missing() function. Stata Journal10: 303–304.
15.
WeissM.2008. Stata tip 66: ds—A hidden gem. Stata Journal8: 448–449.