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

Re: st: Missing values and listing IDs

From   Svend Juul <SJ@SOCI.AU.DK>
To   <>
Subject   Re: st: Missing values and listing IDs
Date   Thu, 13 Nov 2008 16:27:39 +0100

Sham wrote:
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 
list responder_status ID if  x1==. | x2==. | ///
x3==. | x4==. | x5==. | x6==.
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?
   egen miss = rowmiss(x1-x6)
Note that in this -egen- function, x1-x6 is a variable list, as 
opposed the rule for an expression where it means a difference.
It does not necessarily mean x1,x2,x3,x4,x5,x6; that depends on
what variables come between x1 and x6 in the dataset.
Hope this helps

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6 
DK-8000 Aarhus C,  Denmark 
Phone, work:   +45 8942 6090 
Phone, home:   +45 8693 7796 
Fax:           +45 8613 1580 

*   For searches and help try:

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