Stata tip 99: Taking extra care with encode

Research output: Contribution to journalArticle

1 Scopus citations

Abstract

Encode (see [D] encode) has long been one of Stata's basic data-management commands. encode maps the distinct strings of a string variable to an integer-valued numeric variable for which the strings become value labels. Unless you specify a preexisting set of value labels through its label() option, encode uses the alphanumeric order of distinct string values present in the dataset to determine numeric values 1, 2, 3, and so on. Thus if "a", "b", and "d" were the distinct values of a variable, svar, in one dataset, then typing.

Original languageEnglish (US)
Pages (from-to)321-322
Number of pages2
JournalStata Journal
Volume11
Issue number2
StatePublished - Aug 1 2011

    Fingerprint

ASJC Scopus subject areas

  • Mathematics (miscellaneous)

Cite this