Statalist


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

RE: st: Missing values and listing IDs


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Missing values and listing IDs
Date   Thu, 13 Nov 2008 13:23:01 -0000

No. That is legal code, but it doesn't do what you want. 

missing(x1-x6) is true if the difference between the two variables x1
and x6, i.e. the expression x1-x6, is missing, not if any of the
variables x1 through x6 is missing. 

There are at least two ways to see this: 

1. Experiment with made-up data. 

2. Look at the help. You want -missing()- to support
-missing(<varlist>)- but it doesn't. Its arguments must be separated by
commas. (Conversely, a <varlist> cannot contain commas. If it did then
commands based on <cmdname> <varlist> , <options> could not work
reliably.) 

Nick
n.j.cox@durham.ac.uk 

Ashim Kapoor

would missing(x1-x6) work? I have seen that sometimes.


On Thu, Nov 13, 2008 at 6:34 PM, Nick Cox <n.j.cox@durham.ac.uk> wrote:

> Note that what you must type, or otherwise get Stata to see, is
>
> missing(x1,x2,x3,x4,x5,x6)
>
> That is, Stata will not replace an ellipsis ... with what you intend
or
> imply.
>
> That said, you can go
>
> list id if missing(x1,x2,x3,x4,x5,x6)
>
> The new variable is not essential for this purpose.

Johannes Geyer

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

Sham

>> 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==.

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index