The Mishandling of Missing Values within Relational and Logical Expressions in Stata
Published: Sep 2013

This note argues that the design decisions made by Stata in handling missing values in relational and logical expressions have, for the user, convolute, pernicious and poorly understood consequences. It demonstrates this by laying out the complexity entailed by the conventional advice to 'test for missing values'. Then, by way of simplifying, it introduces a utility (validly) which allows for straightforward, and valid, rendition of complex expressions in generate/replace even when faced with missing values. (The utility also permits extensions of the standard syntax, and straightforward deployment of conditional commands.) In conclusion, this paper argues that, the existence of validly notwithstanding, the underlying Stata syntax should (and could costlessly) be changed.

No current keywords


  • Kenneth Macdonald
  • ,

Download Paper