Speaking stata: How best to generate indicator or dummy variables

Nicholas J. Cox, Clyde B. Schechter

Research output: Contribution to journalArticle

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 1 2019

Fingerprint

Notation
Observation
False
Truth

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)

Cite this

Speaking stata : How best to generate indicator or dummy variables. / Cox, Nicholas J.; Schechter, Clyde B.

In: Stata Journal, Vol. 19, No. 1, dm0099, 01.03.2019, p. 246-259.

Research output: Contribution to journalArticle

@article{1014162a58f043f99bc80a8c0e721a8f,
title = "Speaking stata: How best to generate indicator or dummy variables",
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 = "All, Any, Dm0099, Dummy variable, Functions, Indicator variable, Logical and relational operators, Merge, Missing values, True or false",
author = "Cox, {Nicholas J.} and Schechter, {Clyde B.}",
year = "2019",
month = "3",
day = "1",
doi = "10.1177/1536867X19830921",
language = "English (US)",
volume = "19",
pages = "246--259",
journal = "Stata Journal",
issn = "1536-867X",
publisher = "DPC Nederland",
number = "1",

}

TY - JOUR

T1 - Speaking stata

T2 - How best to generate indicator or dummy variables

AU - Cox, Nicholas J.

AU - Schechter, Clyde B.

PY - 2019/3/1

Y1 - 2019/3/1

N2 - 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.

AB - 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.

KW - All

KW - Any

KW - Dm0099

KW - Dummy variable

KW - Functions

KW - Indicator variable

KW - Logical and relational operators

KW - Merge

KW - Missing values

KW - True or false

UR - http://www.scopus.com/inward/record.url?scp=85067831211&partnerID=8YFLogxK

UR - http://www.scopus.com/inward/citedby.url?scp=85067831211&partnerID=8YFLogxK

U2 - 10.1177/1536867X19830921

DO - 10.1177/1536867X19830921

M3 - Article

AN - SCOPUS:85067831211

VL - 19

SP - 246

EP - 259

JO - Stata Journal

JF - Stata Journal

SN - 1536-867X

IS - 1

M1 - dm0099

ER -