Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Assigning missing values [was: RE: Thread-Index: AcsBvuIZsv48hZwTRSGxCrT1fAtTUQ==]

From   "Nick Cox" <>
To   <>
Subject   st: Assigning missing values [was: RE: Thread-Index: AcsBvuIZsv48hZwTRSGxCrT1fAtTUQ==]
Date   Tue, 1 Jun 2010 20:21:44 +0100

Three points on different levels:

1. What you are doing is fine. 

2. -if inlist(q50h, 0, 11)- is another way to do it. (So is -if !inrange(q50h, 1, 10-)

3. Check out -mvdecode-. That's probably the efficient method you roughly have in mind. 


Wald,Kenneth D

Simple as it seems, I'm having a problem understanding how to assign missing values to a Stata dataset that did not have any missing values designated when it was created. I've gone through the FAQs and documentation but most of it seems to apply to cases where a missing value was designated during data input, not my situation.

The variable "q50h" has legitimate values of 1-10 and values of 0 and 11 for cases that I want to consider missing. The simplest way I've found to do this is by this command:

replace q50h=. if (q50h==0)|(q50h==11)

This works but I have the feeling there should be a more efficient way to do this for a large number of variables. I know I could simplify a bit by placing "q50h>=1 & q50h<=10" after the "if" but that's not much more efficient.  

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index