Newbie - Using intermediate variables correctly?

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

Newbie - Using intermediate variables correctly?

ECL
I am trying to compute a new variable E=1.

IF (Q68 GT 0)
AND (Q69 GT 1)
AND (Q71 GT 1)
AND (Q70 GT 1)
AND (Q72>1)
AND (Q46=0)
AND (Q51=0)
AND (Q22=0) E=1.
Execute. (this part runs ok).


Then I am trying to compute a new variable B1b which is conditional upon E not being 1.
I cannot get this to run, can anyone help with my rookie error?

IF(
(Q17 GT 3)
AND (Q20 GT 2)
AND (Q19 GT 1)
AND (Q5 GT 3)
AND (Q8 GT 3)
AND (Q23=0)
AND (Q18=1)
)
AND NOT (E=1) B1b=1.
Execute.

Thank you
Reply | Threaded
Open this post in threaded view
|

Re: Newbie - Using intermediate variables correctly?

David Marso
Administrator
Please elaborate "I cannot get this to run"
What does it do?
It is fine syntactically (if perhaps a bit clumsy), you may want to show sample data and results?
Here is evidence that it works.
DATA LIST FREE /q17 q20 q19 q5 q8 q23 q18 e.
BEGIN DATA
4 3 2 4 4 0 1 0
4 3 2 4 4 0 1 1
3 3 2 4 4 0 1 1
. 3 2 4 4 0 1 0
END DATA.
IF(
(Q17 GT 3)
AND (Q20 GT 2)
AND (Q19 GT 1)
AND (Q5 GT 3)
AND (Q8 GT 3)
AND (Q23=0)
AND (Q18=1)
)
AND NOT (E=1) B1b=1.
LIST.
 
 
     q17      q20      q19       q5       q8      q23      q18        e      B1b
 
    4.00     3.00     2.00     4.00     4.00      .00     1.00      .00     1.00
    4.00     3.00     2.00     4.00     4.00      .00     1.00     1.00      .
    3.00     3.00     2.00     4.00     4.00      .00     1.00     1.00      .
     .       3.00     2.00     4.00     4.00      .00     1.00      .00      .
 
 
Number of cases read:  4    Number of cases listed:  4


ECL wrote
I am trying to compute a new variable E=1.

IF (Q68 GT 0)
AND (Q69 GT 1)
AND (Q71 GT 1)
AND (Q70 GT 1)
AND (Q72>1)
AND (Q46=0)
AND (Q51=0)
AND (Q22=0) E=1.
Execute. (this part runs ok).


Then I am trying to compute a new variable B1b which is conditional upon E not being 1.
I cannot get this to run, can anyone help with my rookie error?

IF(
(Q17 GT 3)
AND (Q20 GT 2)
AND (Q19 GT 1)
AND (Q5 GT 3)
AND (Q8 GT 3)
AND (Q23=0)
AND (Q18=1)
)
AND NOT (E=1) B1b=1.
Execute.

Thank you
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Newbie - Using intermediate variables correctly?

David Marso
Administrator
I'll bet your 'rookie error' is that for cases that don't pass the first test, E is missing!
Hence the final conjunct NOT(E=1) resolves to MISSING.
Consequently the entire conjunction evaluates to missing.

David Marso wrote
Please elaborate "I cannot get this to run"
What does it do?
It is fine syntactically (if perhaps a bit clumsy), you may want to show sample data and results?
Here is evidence that it works.
DATA LIST FREE /q17 q20 q19 q5 q8 q23 q18 e.
BEGIN DATA
4 3 2 4 4 0 1 0
4 3 2 4 4 0 1 1
3 3 2 4 4 0 1 1
. 3 2 4 4 0 1 0
END DATA.
IF(
(Q17 GT 3)
AND (Q20 GT 2)
AND (Q19 GT 1)
AND (Q5 GT 3)
AND (Q8 GT 3)
AND (Q23=0)
AND (Q18=1)
)
AND NOT (E=1) B1b=1.
LIST.
 
 
     q17      q20      q19       q5       q8      q23      q18        e      B1b
 
    4.00     3.00     2.00     4.00     4.00      .00     1.00      .00     1.00
    4.00     3.00     2.00     4.00     4.00      .00     1.00     1.00      .
    3.00     3.00     2.00     4.00     4.00      .00     1.00     1.00      .
     .       3.00     2.00     4.00     4.00      .00     1.00      .00      .
 
 
Number of cases read:  4    Number of cases listed:  4


ECL wrote
I am trying to compute a new variable E=1.

IF (Q68 GT 0)
AND (Q69 GT 1)
AND (Q71 GT 1)
AND (Q70 GT 1)
AND (Q72>1)
AND (Q46=0)
AND (Q51=0)
AND (Q22=0) E=1.
Execute. (this part runs ok).


Then I am trying to compute a new variable B1b which is conditional upon E not being 1.
I cannot get this to run, can anyone help with my rookie error?

IF(
(Q17 GT 3)
AND (Q20 GT 2)
AND (Q19 GT 1)
AND (Q5 GT 3)
AND (Q8 GT 3)
AND (Q23=0)
AND (Q18=1)
)
AND NOT (E=1) B1b=1.
Execute.

Thank you
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"