LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (November 2006)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 12 Nov 2006 17:45:53 -0500
Reply-To:     Frank Gallo <fgallo@charter.net>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Frank Gallo <fgallo@charter.net>
Subject:      Re: Conditional Statement
Comments: To: Catherine Kubitschek <Catherine.A.Kubitschek.2@nd.edu>,
          Art Kendall <Art@DrKendall.org>
In-Reply-To:  <6.2.1.2.2.20061112120248.02ec83b0@pop.nd.edu>
Content-Type: text/plain; charset="us-ascii"

Hi Catherine and Art,

Thank you for your responses. Here are my categories:

compute cat1= (offverb1 eq 1) and any(1, offrest1, offrest2, offrest3). compute cat2= any(1, offverb2, offverb3). compute cat3= any(1, offpst1, offpst2, offpst3). compute cat4= any(1, offgrab, offabr, offpp, offkick, offstr, offwrgd, offwrst, offtake, offoth). compute cat5= any(1, offchemv, offchemd, offchemu). compute cat6= any(1, offbatv, offbatd, offbatu, offdogv, offdogd, offdogu). compute cat7= any(1, offhanv, offhand, offhanu, offshov, offshod, offshou, offtoov, offtood, offtoou).

I would like to compute the frequency of cases in which possible combinations of these categories occur. But, the non-test variable values in each category must equal 0. For example:

compute comb1= cat1. *all the other variable values in each category equal 0*

compute comb2= cat1 and cat2. *all the other variable values in each category equal 0*

compute comb3= cat1 and cat2 and cat3. *all the other variable values in each category equal 0*

etc....

I hope this helps. Catherine, I am more familiar with the "point and click" method than with "writing syntax." While your binary example looks promising, I do not understand the logic. Please excuse my limited knowledge of syntax. Thank you.

Best, Frank

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Catherine Kubitschek Sent: Sunday, November 12, 2006 12:16 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Re: Conditional Statement

Frank,

Would something like this work for you? I've created two variables in the end which do the same thing - decimal is easier to see but binary doesn't create such a large number. I think either would give you the frequencies you're looking at.

Catherine

data list / offverb1 1 offverb2 2 offverb3 3 offrest1 4 offrest2 5 offrest3 6 . begin data 000000 100000 010000 000001 110000 100010 101010 111100 111111 end data .

compute cat1=(offverb1=1) . compute cat2=any(1,offverb2,offverb3) . compute cat3=any(1,offrest1,offrest2,offrest3) . * or you could do it like this: * compute cat2=(offverb2=1 or offverb3=1) . * compute cat3=(offrest1=1 or offrest2=1 or offrest3=1) .

compute decimal=cat1 + (10*cat2) + (100*cat3) . compute binary =cat1 + ( 2*cat2) + ( 4*cat3) .

value labels decimal 0 'none' 1 'cat 1 only' 10 'cat 2 only' 11 'cat 1 and 2 only' 100 'cat 3 only' 101 'cat 1 and 3 only' 110 'cat 2 and 3 only' 111 'cat 1, 2, and 3 only' . value labels binary 0 'none' 1 'cat 1 only' 2 'cat 2 only' 3 'cat 1 and 2 only' 4 'cat 3 only' 5 'cat 1 and 3 only' 6 'cat 2 and 3 only' 7 'cat 1, 2, and 3 only' .

frequencies var=decimal binary . execute .

At 11/12/2006 11:06 AM, Frank Gallo wrote: >Hi Catherine, > >Thank you for your response. Here is some clarification on my earlier post. > >I have 8 categories with different variables (or behaviors) assigned. > >Category 1: offverb1 >Category 2: offverb2, offverb3 >Category 3: offrest1, offrest2, offrest3 >Category 4: offpst1, offpst2, offpst3 >Category 5: offgrab, offabr, offpp, offkick, offstr, offwrgd, offwrst, > offtake, offoth >Category 6: offchemv, offchemd, offchemu >Category 7: offbatv, offbatd, offbatu, offdogv, offdogd, offdogu >Category 8: offhanv, offhand, offhanu, offshov, offshod, offshou, offtoov, > offtood, offtoou > >I would like to compute the frequency of cases in which possible >combinations of these categories occur. For example: > >1 + 3 only >1 + 2 + 3 only >1 + 2 + 3 + 4 only >1 + 2 + 3 + 4 + 5 only >1 + 2 + 3 + 4 + 5 + 6 only >1 + 2 + 3 + 4 + 5 + 6 + 7 only >1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 >etc.... > >Thank you, >Frank > >-----Original Message----- >From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of >Catherine Kubitschek >Sent: Sunday, November 12, 2006 10:39 AM >To: SPSSX-L@LISTSERV.UGA.EDU >Subject: Re: Conditional Statement > >Frank, I don't think anyone from the SPSS list can give you much help >without knowing what you're trying to do and why you think there are too >many true cases. I did reformat your if condition so I could see what you >were trying to do more clearly. I'd suggest you just take a good look at >your logic and see if you've got it coded as you want it. > >At 11/12/2006 10:21 AM, you wrote (in part): > > (offverb1 = 1) > > and (offverb2 = 1 or offverb3 = 1) > > and (offrest1 = 1 or offrest2 = 1 or offrest3 = 1) > > and (offpst1 = 1 or offpst2 = 1 or offpst3 = 1) > > and (offgrab = 1 or offabr = 1 or offpp = 1 or offkick = 1 > > or offstr = 1 or offwrgd = 1 or offwrst = 1 > > or offtake = 1 or offoth = 1) > > and (offchemv =1 or offchemd = 1 or offchemu = 1) > > and (offbatv = 1 or offbatd = 1 or offbatu = 1 or offdogv = 1 > > or offdogd = 1 or offdogu = 1) > > and (offhanv = 1 or offhand = 1 or offhanu = 1 or offshov = 1 > > or offshod = 1 or offshou = 1 or offtoov = 1 > > or offtood = 1 or offtoou = 1) > >if it makes it easier to read (it doesn't change what you're doing) you >could rewrite this using any - something like this > >... >and >any(1,offgrab,offabr,offpp,offkick,offstr,offwrgd,offwrst,offtake,offoth) >... > >Catherine


Back to: Top of message | Previous page | Main SPSSX-L page