Three-Valued Logic Operations in Stata
David Kantor
No 5.2, North American Stata Users' Group Meetings 2001 from Stata Users Group
Abstract:
Stata uses numeric quantities as logical values, and provides logical operators (&, |, ~) to build expressions from basic entities. These operators can be regarded as faulty when missing values are present in the operands. In this context, missing is equivalent to true, which is often not the desired result. Instead, one may want to obtain the maximal set of nonmissing results for all combinations of operand values, while preserving the behavior of the operators on two-valued operands -- in other words, one should adopt three-valued logic. I have developed a set of egen functions that provide this capability. As such, they can only do one type of operation at a time, so that complex expressions would need to be built in stages. But they can be a great help when you wish to generate indicator variables and want the maximal set of nonmissing results.
Date: 2001-01-15
References: Add references at CitEc
Citations:
Downloads: (external link)
http://fmwww.bc.edu/RePEc/nasug2001/tvl05.txt (text/plain)
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:boc:asug01:5.2
Access Statistics for this paper
More papers in North American Stata Users' Group Meetings 2001 from Stata Users Group Contact information at EDIRC.
Bibliographic data for series maintained by Christopher F Baum ().