Speaking Stata: How best to generate indicator or dummy variables
Nicholas Cox
Stata Journal, 2019, vol. 19, issue 1, 246-259
Abstract:
Indicator or dummy variables record whether some condition is true or false in each observation by a value of 1 or 0. Values may also be missing if truth or falsity is not known, and that fact should be flagged. Such indicators may be created on the fly by using factor-variable notation. tabulate also offers one method for automating the generation of indicators. In this column, we discuss in detail how otherwise to best generate such variables directly, with comments here and there on what not to do.
Keywords: indicator variable; dummy variable; true or false; any; all; missing values; logical and relational operators; functions; merge (search for similar items in EconPapers)
Date: 2019
Note: to access software from within Stata, net describe http://www.stata-journal.com/software/sj18-3/dm0099/
References: Add references at CitEc
Citations:
Downloads: (external link)
http://hdl.handle.net/10.1177/1536867X19830921
Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.
Export reference: BibTeX
RIS (EndNote, ProCite, RefMan)
HTML/Text
Persistent link: https://EconPapers.repec.org/RePEc:tsj:stataj:y:19:y:2019:i:1:p:246-259
Ordering information: This journal article can be ordered from
http://www.stata-journal.com/subscription.html
DOI: 10.1177/1536867X19830921
Access Statistics for this article
Stata Journal is currently edited by Nicholas J. Cox and Stephen P. Jenkins
More articles in Stata Journal from StataCorp LLC
Bibliographic data for series maintained by Christopher F. Baum () and Lisa Gilmore ().