Statalist


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

Re: st: Missing values and listing IDs


From   Johannes Geyer <[email protected]>
To   [email protected]
Subject   Re: st: Missing values and listing IDs
Date   Thu, 13 Nov 2008 13:58:25 +0100

> I wish to list the ID numbers of those individuals in my dataset 
> that have at least one missing value out any six variables (x1-x6). 
> At the moment I have used the following logic: 
> 
> list responder_status ID if  x1==. | x2==. | ///
> x3==. | x4==. | x5==. | x6==.

gen miss0 = missing(x1,x2,x3,...,x6)
list id if miss0 == 1

Johannes

> 
> But I'm not sure if this is correct, so I did the following which I 
think is.
> 
> gen miss=0 
> recode miss 0=1 if x1==.
> recode miss 0=1 if x2==.
> recode miss 0=1 if x3==. 
> recode miss 0=1 if x4==.
> recode miss 0=1 if x5==.
> recode miss 0=1 if x6==.
> 
> 
> However is there a more succinct way to write this code, instead of 7 
lines?
> 
> Thanks in advance 
> Sham 
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index