Speaking stata: How best to generate indicator or dummy variables

Nicholas J. Cox, Clyde B. Schechter

Research output: Contribution to journalArticlepeer-review

10 Scopus citations

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.

Original languageEnglish (US)
Article numberdm0099
Pages (from-to)246-259
Number of pages14
JournalStata Journal
Volume19
Issue number1
DOIs
StatePublished - Mar 2019

Keywords

  • All
  • Any
  • Dm0099
  • Dummy variable
  • Functions
  • Indicator variable
  • Logical and relational operators
  • Merge
  • Missing values
  • True or false

ASJC Scopus subject areas

  • Mathematics (miscellaneous)

Fingerprint

Dive into the research topics of 'Speaking stata: How best to generate indicator or dummy variables'. Together they form a unique fingerprint.

Cite this