COUNT missing values

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

COUNT missing values

Jim Groeneveld-2
Hi friends,

Firstly a brief introduction. I have been using different versions of SPSS
from 1975 to 1996. First versions were various mainframe versions on
different mainframe platforms, only command language oriented. Later I've
been using SPSS/PC, intially text versions, but already with a user
interface, allowing selecting all kinds of transformations and statistical
analyses via the menu. Subsequent versions have a GUI as you know, that I've
been using for some time.

Since 1997 I've been using (different versions of) SAS, and never have been
using SPSS again. I am a rather active contributor to SAS-L. But I didn't
forget SPSS, which has some features that can not be found in SAS and which
can only be programmed in SAS in a more complex way. One of those is the
COUNT command, that with a minimum of code can count various occurrences
quite easily.

For SAS I have written a simple %COUNT macro that, though with another
syntax then SPSS, does about the same as the SPSS COUNT command. The
advantage is that it needs as less programming and specification of
variables and values as in SPSS. Now I'm writing a paper about the macro and
compare it to the SPSS COUNT command. There still is something not entirely
clear to me about the COUNT command in relation to missing values and that
is why I am posting this question to SPSSX-L.

Suppose you have defined the values 77, 88 and 99 as missing values for a
Variable in SPSS and you want the count of the value 88 only (which is
missing). Is the following command correct in the case?

COUNT Counter = Variable (88).

Does it indeed count the value 88 selectively? Or is it _only_ possible to
count _all_ missing values together while specifying the value MISSING or
SYSMIS? Not that it matters to my macro, but in my paper I would like to
present a correct example of such an instance. And I could not find this
specific situation in the various documentation on the internet. And I don't
have SPSS at hand to just try it.

All comments appreciated.

Regards - Jim.
--
Jim Groeneveld, Netherlands
Statistician, SAS consultant
home.hccnet.nl/jim.groeneveld
Reply | Threaded
Open this post in threaded view
|

Re: COUNT missing values

Art Kendall
Vi Ann thought you might not have SPSS available, so here is the syntax
and the LIST output.
It is best viewed in fixed pitch fonts.

data list list/ v1 to v5 (5f2).
begin data
1 2 88 99 99
88 88 88 88 88
99 88 77 3 88
5 4 99 88 99
. . 5 77 88
end data.
missing values v1 to v5 (77,88,99).
count score77 = v1 to v5 (77).
count score88 = v1 to v5 (88).
count score1_5= v1 to v5 (1 thru 5).
count mis     = v1 to v5 (missing).
count sy      = v1 to v5 (sysmis).
count either  = v1 to v5 (missing,sysmis).
count mix1    = v1 to v5 (77, sysmis).
list.




v1 v2 v3 v4 v5 score77 score88 score1_5    mis     sy either   mix1

 1  2 88 99 99       0       1       2       3      0      3      0
88 88 88 88 88       0       5       0       5      0      5      0
99 88 77  3 88       1       2       1       4      0      4      1
 5  4 99 88 99       0       1       2       3      0      3      0
 .  .  5 77 88       1       1       1       4      2      4      3


Number of cases read:  5    Number of cases listed:  5

Art Kendall
Social Research Consultants

Jim Groeneveld wrote:

>Hi friends,
>
>Firstly a brief introduction. I have been using different versions of SPSS
>from 1975 to 1996. First versions were various mainframe versions on
>different mainframe platforms, only command language oriented. Later I've
>been using SPSS/PC, intially text versions, but already with a user
>interface, allowing selecting all kinds of transformations and statistical
>analyses via the menu. Subsequent versions have a GUI as you know, that I've
>been using for some time.
>
>Since 1997 I've been using (different versions of) SAS, and never have been
>using SPSS again. I am a rather active contributor to SAS-L. But I didn't
>forget SPSS, which has some features that can not be found in SAS and which
>can only be programmed in SAS in a more complex way. One of those is the
>COUNT command, that with a minimum of code can count various occurrences
>quite easily.
>
>For SAS I have written a simple %COUNT macro that, though with another
>syntax then SPSS, does about the same as the SPSS COUNT command. The
>advantage is that it needs as less programming and specification of
>variables and values as in SPSS. Now I'm writing a paper about the macro and
>compare it to the SPSS COUNT command. There still is something not entirely
>clear to me about the COUNT command in relation to missing values and that
>is why I am posting this question to SPSSX-L.
>
>Suppose you have defined the values 77, 88 and 99 as missing values for a
>Variable in SPSS and you want the count of the value 88 only (which is
>missing). Is the following command correct in the case?
>
>COUNT Counter = Variable (88).
>
>Does it indeed count the value 88 selectively? Or is it _only_ possible to
>count _all_ missing values together while specifying the value MISSING or
>SYSMIS? Not that it matters to my macro, but in my paper I would like to
>present a correct example of such an instance. And I could not find this
>specific situation in the various documentation on the internet. And I don't
>have SPSS at hand to just try it.
>
>All comments appreciated.
>
>Regards - Jim.
>--
>Jim Groeneveld, Netherlands
>Statistician, SAS consultant
>home.hccnet.nl/jim.groeneveld
>
>
>
>
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: COUNT missing values

Oliver, Richard
In reply to this post by Jim Groeneveld-2
First of all, COUNT counts the occurrence of the specified values across cases; so I'm not sure I understand your example. Second, COUNT ignores user-missing status. The documentation says: "COUNT ignores the missing-value status of user-missing values. It counts a value even if that value has been previously declared as missing."

A simple example verifies this:

data list free /var1 var2 var3.
begin data.
1 2 3
3 2 3
3 3 3
end data.
missing values var1 to var3 (3).
count countvar=var1 to var3 (3).
list countvar.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jim Groeneveld
Sent: Friday, September 22, 2006 3:18 AM
To: [hidden email]
Subject: COUNT missing values

Hi friends,

Firstly a brief introduction. I have been using different versions of SPSS from 1975 to 1996. First versions were various mainframe versions on different mainframe platforms, only command language oriented. Later I've been using SPSS/PC, intially text versions, but already with a user interface, allowing selecting all kinds of transformations and statistical analyses via the menu. Subsequent versions have a GUI as you know, that I've been using for some time.

Since 1997 I've been using (different versions of) SAS, and never have been using SPSS again. I am a rather active contributor to SAS-L. But I didn't forget SPSS, which has some features that can not be found in SAS and which can only be programmed in SAS in a more complex way. One of those is the COUNT command, that with a minimum of code can count various occurrences quite easily.

For SAS I have written a simple %COUNT macro that, though with another syntax then SPSS, does about the same as the SPSS COUNT command. The advantage is that it needs as less programming and specification of variables and values as in SPSS. Now I'm writing a paper about the macro and compare it to the SPSS COUNT command. There still is something not entirely clear to me about the COUNT command in relation to missing values and that is why I am posting this question to SPSSX-L.

Suppose you have defined the values 77, 88 and 99 as missing values for a Variable in SPSS and you want the count of the value 88 only (which is missing). Is the following command correct in the case?

COUNT Counter = Variable (88).

Does it indeed count the value 88 selectively? Or is it _only_ possible to count _all_ missing values together while specifying the value MISSING or SYSMIS? Not that it matters to my macro, but in my paper I would like to present a correct example of such an instance. And I could not find this specific situation in the various documentation on the internet. And I don't have SPSS at hand to just try it.

All comments appreciated.

Regards - Jim.
--
Jim Groeneveld, Netherlands
Statistician, SAS consultant
home.hccnet.nl/jim.groeneveld
Reply | Threaded
Open this post in threaded view
|

Re: COUNT missing values

Oliver, Richard
Oops. I meant "across variables" not cases. So, in my example, it would return 1 for the first case, 2 for the second case and 3 for the third case.

If you want the count across cases, use Frequencies, which will include a section that reports user- and system-missing values (with separate counts for each user-missing category).

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Oliver, Richard
Sent: Friday, September 22, 2006 1:30 PM
To: [hidden email]
Subject: Re: COUNT missing values

First of all, COUNT counts the occurrence of the specified values across cases; so I'm not sure I understand your example. Second, COUNT ignores user-missing status. The documentation says: "COUNT ignores the missing-value status of user-missing values. It counts a value even if that value has been previously declared as missing."

A simple example verifies this:

data list free /var1 var2 var3.
begin data.
1 2 3
3 2 3
3 3 3
end data.
missing values var1 to var3 (3).
count countvar=var1 to var3 (3).
list countvar.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jim Groeneveld
Sent: Friday, September 22, 2006 3:18 AM
To: [hidden email]
Subject: COUNT missing values

Hi friends,

Firstly a brief introduction. I have been using different versions of SPSS from 1975 to 1996. First versions were various mainframe versions on different mainframe platforms, only command language oriented. Later I've been using SPSS/PC, intially text versions, but already with a user interface, allowing selecting all kinds of transformations and statistical analyses via the menu. Subsequent versions have a GUI as you know, that I've been using for some time.

Since 1997 I've been using (different versions of) SAS, and never have been using SPSS again. I am a rather active contributor to SAS-L. But I didn't forget SPSS, which has some features that can not be found in SAS and which can only be programmed in SAS in a more complex way. One of those is the COUNT command, that with a minimum of code can count various occurrences quite easily.

For SAS I have written a simple %COUNT macro that, though with another syntax then SPSS, does about the same as the SPSS COUNT command. The advantage is that it needs as less programming and specification of variables and values as in SPSS. Now I'm writing a paper about the macro and compare it to the SPSS COUNT command. There still is something not entirely clear to me about the COUNT command in relation to missing values and that is why I am posting this question to SPSSX-L.

Suppose you have defined the values 77, 88 and 99 as missing values for a Variable in SPSS and you want the count of the value 88 only (which is missing). Is the following command correct in the case?

COUNT Counter = Variable (88).

Does it indeed count the value 88 selectively? Or is it _only_ possible to count _all_ missing values together while specifying the value MISSING or SYSMIS? Not that it matters to my macro, but in my paper I would like to present a correct example of such an instance. And I could not find this specific situation in the various documentation on the internet. And I don't have SPSS at hand to just try it.

All comments appreciated.

Regards - Jim.
--
Jim Groeneveld, Netherlands
Statistician, SAS consultant
home.hccnet.nl/jim.groeneveld