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 (newsgroup comp.soft-sys.sas). 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 P.S. Does SPSS still stand for Statistical Package for the Social Sciences? |
Your syntax: COUNT Counter = Variable (88) will result:
If a case has value 88 on Variable it will have a value 1 on Counter. If a case has any other value on Variable it will have a value of 0 on Counter. Dominic Lusinchi Statistician Far West Research Statistical Consulting San Francisco, California 415-664-3032 www.farwestresearch.com -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jim Groeneveld Sent: Friday, September 22, 2006 7:44 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 (newsgroup comp.soft-sys.sas). 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 P.S. Does SPSS still stand for Statistical Package for the Social Sciences? |
In reply to this post by Jim Groeneveld
There is example syntax below the sig block.
Save all your current work, then open a new instance of SPSS. Make sure that you put warnings, etc. into the output file. <edit> <options> <viewer>. Cut-and-paste then run the syntax. Does this do what you want? If not please restate your question in more detail. Perhaps post a small data set with variables "have" and "want". Hope this helps. Art Social Research Consultants (Inside the Washington, DC beltway.) 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. 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 (newsgroup >comp.soft-sys.sas). 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 > >P.S. Does SPSS still stand for Statistical Package for the Social Sciences? > > > >
Art Kendall
Social Research Consultants |
Free forum by Nabble | Edit this page |