Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Delete cases with missing values

1,640 views
Skip to first unread message

Libin Xu

unread,
Jun 26, 1998, 3:00:00 AM6/26/98
to

Dear Spssx-lers,
I wonder if anyone can help me with this problem. I want to
delete some cases when the values of all three variables are missing. In
SAS, you can use the command like
if var1=missing and var2=missing and var3=missing then delete. what
should I do with SPSS for Windows? I looked at an old menu which has
select if missing(var). But it won't work with a list of variables.
Thank you for your assistance.

Libin Xu

Markus Quandt

unread,
Jun 27, 1998, 3:00:00 AM6/27/98
to

In article <3593F44F...@pgcps.org>,


select if (missing(var1) + missing(var2) + missing(var3)) eq 3.
save outfile "newfile.sav".

will probably do what you want. MISSING(var) is a logical function
which returns the numerical values of '1' and '0' to represent
'true' and 'false', and you can do normal arithmetic with these
values.

You might want to check the other functions as well. A complete
list is given in the online help on the COMPUTE statement.
Unfortunately, I wasn't able to find documentation on the
functions anywhere in the printed manuals, which I consider quite
deficient, because the online help is not always optimal. If
anyone knows where to look, please tell me...

Regards, MQ

--
--------------------------------------------------------------------
Markus Quandt qua...@wiso.Uni-Koeln.DE
Universitaet zu Koeln
University of Cologne, Germany

Edward F. Tverdek

unread,
Jun 27, 1998, 3:00:00 AM6/27/98
to qua...@wiso-r610.wiso.uni-koeln.de

Markus,

You'll find documentation on the MISSING as well as most other functions
for numeric, string and date variables in the "Universals" section at
the beginning of the SPSS Syntax Reference Guide appropriate for your
version of SPSS. MISSING is described along with VALUE, SYSMIS, NMISS,
and NVALID in a section called "Missing Value Functions" (e.g. on pages
59-60 of the 6.1 SRG, the only version I have handy here).

I hope this helps,

Ed Tverdek

Ann Byron

unread,
Jun 27, 1998, 3:00:00 AM6/27/98
to

I think the following should work:
if (sysmis(var1) eq 1) and (sysmis(var2) eq 1) and (sysmis(var3) eq 1)


Edward F. Tverdek

unread,
Jun 27, 1998, 3:00:00 AM6/27/98
to

In my haste to address Markus' question about the availability of
documentation on SPSS functions, I forgot to mention what prompted
a note in the first place. Libin wanted to delete cases that are
missing on the three variables of interest. Markus' suggestion should
do this provided you change the "eq" to "ne" or "<>" (or wrap the entire
set of conditions in a "NOT()"; there are at least a dozen ways to do
this). Libin would want to retain only those cases where the sum of the
logical conditions is *not* equal to three -- i.e. where at least one of
the variables has a valid value.

Ed Tverdek

Neila Nessa

unread,
Jun 28, 1998, 3:00:00 AM6/28/98
to

Select if NVALID(var1,var2,var3) >0 .
or
Select if NOT(NMISS(var1,var2,var3)=3).

* The side discussion involving SYSMIS(var1)+Sysmis(var2)...+
is simply too confusing for my simple mind ;-)
The little adage about forests and trees and hammers and
finger-nails comes to mind!
NN

Libin Xu wrote in message <3593F44F...@pgcps.org>...


>Dear Spssx-lers,
> I wonder if anyone can help me with this problem. I want to
>delete some cases when the values of all three variables are missing. In
>SAS, you can use the command like
>if var1=missing and var2=missing and var3=missing then delete. what
>should I do with SPSS for Windows? I looked at an old menu which has
>select if missing(var). But it won't work with a list of variables.
> Thank you for your assistance.
>

>Libin Xu

Markus Quandt

unread,
Jun 28, 1998, 3:00:00 AM6/28/98
to

In article <JtNl14AN...@wiso.Uni-Koeln.DE>,

qua...@wiso.Uni-Koeln.DE (Markus Quandt) wrote:
>In article <3593F44F...@pgcps.org>,
>Libin Xu <lib...@PGCPS.PG.K12.MD.US> wrote:
>>Dear Spssx-lers,
>> I wonder if anyone can help me with this problem. I want to
>>delete some cases when the values of all three variables are missing. In
>>SAS, you can use the command like
>>if var1=missing and var2=missing and var3=missing then delete. what
>>should I do with SPSS for Windows? I looked at an old menu which has
>>select if missing(var). But it won't work with a list of variables.
>> Thank you for your assistance.
>
>
>select if (missing(var1) + missing(var2) + missing(var3)) eq 3.
>save outfile "newfile.sav".
>
>will probably do what you want. MISSING(var) is a logical function
>which returns the numerical values of '1' and '0' to represent
>'true' and 'false', and you can do normal arithmetic with these
>values.

Ed Tverdek from SPSS sent me a note regarding my question on where
to find documentation for command syntax (there's a special
manual for that!). On that occasion I reread my own posting and
noticed that I wrote obvious nonsense.

Of course, the select command should be:

select if (missing(var1) + missing(var2) + missing(var3)) ne 3.
^^

and not '...eq 3.', which will achieve the opposite of what was
needed and leave only the cases with all missing values in the
file. Sorry for this mistake, but I hope the original poster could
easily sort *this* out for himself.

Peter Lxvgreen

unread,
Jun 29, 1998, 3:00:00 AM6/29/98
to

I think that the correct syntax should look like this:

Select if (not missing(var1) and not missing(var2) and not missing(var3)).
Execute.

Otherwise you would end up with only the missing cases. Isen't that so?

Greetings
Peter L?vgreen

Fabrizio Arosio <Fabrizi...@ROTTA.COM> on 29-06-98 11:33:50

Please respond to Fabrizi...@ROTTA.COM

To: SPS...@UGA.CC.UGA.EDU
cc: (bcc: Peter L?vgreen/UFV)
Subject: Re: Delete cases with missing values

Content-type: text/plain; charsetus-ascii


Libin,
you need to use the SELECT IF command in the following way:
Select if (missing(var1) and missing(var2) and missing(var3)).
Execute.
The above syntax will permanently delete in your active data file
the cases with var1, var2 and var3 all containing the missing value.
If you wanted to delete that cases only for a particular
SPSS procedure, it is possible to use the Temporary command:
Temporary.
Select if (missing(var1) and missing(var2) and missing(var3)).
<spss procedure 1>
<spss procedure 2>
In the above syntax, only the <spss procedure 1> will work without
the deleted cases; <spss procedure 2> will work with all the cases of
your original data-file.
I hope I've been clear: sorry for my bad english :-).
Greetings,
Fabrizio

Libin Xu <lib...@PGCPS.PG.K12.MD.US> on 26/06/98 21.19.43
Please respond to Libin Xu <lib...@PGCPS.PG.K12.MD.US>
To: SPS...@UGA.CC.UGA.EDU
cc: (bcc: Fabrizio Arosio/RRL/IT)
Subject: Delete cases with missing values

Dear Spssx-lers,
I wonder if anyone can help me with this problem. I want to
delete some cases when the values of all three variables are missing. In
SAS, you can use the command like

if var1missing and var2missing and var3missing then delete. what


should I do with SPSS for Windows? I looked at an old menu which has
select if missing(var). But it won't work with a list of variables.
Thank you for your assistance.

Libin Xu

Fabrizio Arosio

unread,
Jun 29, 1998, 3:00:00 AM6/29/98
to

<spss procedure 2>

Greetings,
Fabrizio

if var1=missing and var2=missing and var3=missing then delete. what

0 new messages