pspp-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DO IF Block appears to execute regardless


From: Ben Pfaff
Subject: Re: DO IF Block appears to execute regardless
Date: Sun, 2 Feb 2014 10:04:29 -0800
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Jan 16, 2014 at 02:49:33PM +1100, Stuart McKenzie wrote:
> I have a block of code
> 
> COMPUTE PulseCheck = INDEX(UPCASE(@JobName),"PULSE") > 0.
> 
> DO IF (PulseCheck < 1).
>       Recode CONT (Convert) into CONT1.
>       *do other stuff
> END IF.
> 
> If I include the line
> LIST PulseCheck
> I see that PulseCheck is being calculated correctly so that line appears
> to be correct, however, the DO IF block of code currently executes
> regardless of the value of PulseCheck. This script is used to run across 2
> data files, one of which has the CONT variable and the other doesn't, so I
> need to skip over this block when the CONT variable does not exist.  Am I
> missing something stupidly obvious here? The less preferred solution is to
> use 2 scripts, but that has other implications which I would prefer not to
> have to deal with.

I finally took a look at this.  Sorry about the long delay.

I can't reproduce the problem here.  When I run the following, for
example:

    DATA LIST LIST NOTABLE/input.
    BEGIN DATA.
    1
    2
    3
    4
    5
    END DATA.
    DO IF input < 3.
        RECODE input (1=2)(ELSE=COPY) INTO output.
    END IF.
    LIST.

I see the expected output:

    Data List
       input   output
    -----------------
        1.00     2.00
        2.00     2.00
        3.00        .
        4.00        .
        5.00        .

which shows that indeed the RECODE isn't doing anything for input values
less than 3.

If you can provide a complete example of syntax that doesn't behave as
you expect, I'll figure out the problem.

Thanks,

Ben.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]