Conditional Statement

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

Conditional Statement

fgallo
Hi All,



I have a question regarding a conditional statement. I am trying to compute
a new variable, which is a combination of existing ones. Below is my
conditional statement, but it is computing too many "true" (=1) cases. Any
help would be greatly appreciated.



Target Variable = comb1     Numeric Expression = 1



IF Condition



(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)



Thank you,

Frank
Reply | Threaded
Open this post in threaded view
|

Re: Conditional Statement

Catherine Kubitschek
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
Reply | Threaded
Open this post in threaded view
|

Re: Conditional Statement

fgallo
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:[hidden email]] On Behalf Of
Catherine Kubitschek
Sent: Sunday, November 12, 2006 10:39 AM
To: [hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: Conditional Statement

Art Kendall
In reply to this post by fgallo
without context we cannot tell what might work
one trick is to split up your statement while you are developing it.
Using fixed pitch fonts often helps.
So does using extra spaces to vertically align segments.


just changing spacing

     (offverb1 eq 1) and
     (offverb2 eq 1 or offverb3 eq 1)
 and (offrest1 eq 1 or offrest2 eq 1 or offrest3 eq 1)
 and (offpst1  eq 1 or offpst2  eq 1 or offpst3  eq 1)
 and (offgrab  eq 1 or offabr   eq 1 or offpp    eq 1 or
      offkick  eq 1 or offstr   eq 1 or offwrgd  eq 1 or
      offwrst  eq 1 or offtake  eq 1 or offoth   eq 1)
 and (offchemv eq 1 or offchemd eq 1 or offchemu eq 1)
 and (offbatv  eq 1 or offbatd  eq 1 or offbatu  eq 1 or
      offdogv  eq 1 or offdogd  eq 1 or offdogu  eq 1)
 and (offhanv  eq 1 or offhand  eq 1 or offhanu  eq 1 or
      offshov  eq 1 or offshod  eq 1 or offshou  eq 1 or
      offtoov  eq 1 or offtood  eq 1 or offtoou  eq 1)

splitting into parts

compute part1 = (offverb1 eq 1) and
                (offverb2 eq 1 or offverb3 eq 1).
compute part2 = (offrest1 eq 1 or offrest2 eq 1 or offrest3 eq 1).
compute part3 = (offpst1  eq 1 or offpst2  eq 1 or offpst3  eq 1).
compute part4 = (offgrab  eq 1 or offabr   eq 1 or offpp    eq 1 or
                 offkick  eq 1 or offstr   eq 1 or offwrgd  eq 1 or
                 offwrst  eq 1 or offtake  eq 1 or offoth   eq 1).
compute part5 = (offchemv eq 1 or offchemd eq 1 or offchemu eq 1).
compute part6 = (offbatv  eq 1 or offbatd  eq 1 or offbatu  eq 1 or
                 offdogv  eq 1 or offdogd  eq 1 or offdogu  eq 1).
compute part7 = (offhanv  eq 1 or offhand  eq 1 or offhanu  eq 1 or
                 offshov  eq 1 or offshod  eq 1 or offshou  eq 1 or
                 offtoov  eq 1 or offtood  eq 1 or offtoou  eq 1).
compute target = part1 and part2 and part3 and part4 and part5 and part6 and part7.

other ways that might simplify the task to help debugging are:
using "to" if variables are contiguous.
using the any function
dropping "eq 1" if all the variables are zero/one.

Art Kendall
Social Research Consultants




Frank Gallo wrote:

>Hi All,
>
>
>
>I have a question regarding a conditional statement. I am trying to compute
>a new variable, which is a combination of existing ones. Below is my
>conditional statement, but it is computing too many "true" (eq1) cases. Any
>help would be greatly appreciated.
>
>
>
>Target Variable eq comb1     Numeric Expression eq 1
>
>
>
>IF Condition
>
>
>
>(offverb1 eq 1) and (offverb2 eq 1 or offverb3 eq 1) and (offrest1 eq 1 or
>offrest2 eq 1 or offrest3 eq 1) and (offpst1 eq 1 or offpst2 eq 1 or offpst3 eq
>1) and (offgrab eq 1 or offabr eq 1 or offpp eq 1 or offkick eq 1 or offstr eq 1
>or offwrgd eq 1 or offwrst eq 1 or offtake eq 1 or offoth eq 1) and (offchemv eq
>1 or offchemd eq 1 or offchemu eq 1) and (offbatv eq 1 or offbatd eq 1 or
>offbatu eq 1 or offdogv eq 1 or offdogd eq 1 or offdogu eq 1) and (offhanv eq 1
>or offhand eq 1 or offhanu eq 1 or offshov eq 1 or offshod eq 1 or offshou eq 1
>or offtoov eq 1 or offtood eq 1 or offtoou eq 1)
>
>
>
>Thank you,
>
>Frank
>
>
>
>
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Conditional Statement

Catherine Kubitschek
In reply to this post by fgallo
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:[hidden email]] On Behalf Of
>Catherine Kubitschek
>Sent: Sunday, November 12, 2006 10:39 AM
>To: [hidden email]
>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
Reply | Threaded
Open this post in threaded view
|

Re: Conditional Statement

fgallo
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:[hidden email]] On Behalf Of
Catherine Kubitschek
Sent: Sunday, November 12, 2006 12:16 PM
To: [hidden email]
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:[hidden email]] On Behalf Of
>Catherine Kubitschek
>Sent: Sunday, November 12, 2006 10:39 AM
>To: [hidden email]
>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
Reply | Threaded
Open this post in threaded view
|

Re: Conditional Statement

Catherine Kubitschek
Frank,

To begin, it looks like you've merged your category 1 with your category
3.  Not a big thing but it might confuse when comparing the new categories
to the examples that use what I thought were the categories.

The binary example and the decimal example do exactly the same thing.  I
think the decimal is just easier to understand.  For example you could

compute comb2= (decimal=11) . /* remember that 11=011 */

which would mean that cat1 was 1 or true (one's place) and cat2 was 1 or
true (10's place) and cat3 was 0 or false (100's place).

compute comb3=(decimal=111) .

would work because all three categories were equal to 1.

The variable binary just jams all of this into consecutive but not
overlapping numbers (if you actually wrote out the values in binary they
would look like the decimal values - 1, 10, 11, 100, etc).  It works but I
don't find it so intuitive to look at.

I hope that helps instead of muddying the waters.
Catherine

At 11/12/2006 05:45 PM, Frank Gallo wrote:

>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:[hidden email]] On Behalf Of
>Catherine Kubitschek
>Sent: Sunday, November 12, 2006 12:16 PM
>To: [hidden email]
>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:[hidden email]] On Behalf Of
> >Catherine Kubitschek
> >Sent: Sunday, November 12, 2006 10:39 AM
> >To: [hidden email]
> >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