So, 'NOT' is a function, too?

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

So, 'NOT' is a function, too?

Richard Ristow
In discussing some points of coding with Gene Maguin, I said that,

>. 'Not' is a relational prefix, not a function. Write
>"not sysmis(date(#j)))",
>instead of
>"not(sysmis(date(#j))))"

That agrees with the documentation: from the Command Syntax Reference,

>NOT Logical Operator
>The NOT logical operator reverses the true/false outcome of the
>expression that immediately follows.
>.. The NOT operator affects only the expression that immediately
>follows, unless a more complex logical expression is enclosed in parentheses.

However, both syntactic forms actually work. SPSS 14 draft output:
DATA LIST FREE / CaseID (N2) Datum (F2).
BEGIN DATA
01 1 02 0
END DATA.
RECODE Datum (0=SYSMIS).


STRING IsThere1 IsThere2 (A8).

IF not sysmis(Datum)  IsThere1 = 'Present'.
IF not(sysmis(Datum)) IsThere2 = 'Present'.

LIST.
|-----------------------------|---------------------------|
|Output Created               |27-JAN-2008 22:38:43       |
|-----------------------------|---------------------------|
CaseID Datum IsThere1 IsThere2

    1      1  Present  Present
    2      .

Number of cases read:  2    Number of cases listed:  2


I don't find 'NOT', as a function, documented in the CSR. Was it
implemented initially as a function, and kept in later
implementations where it was also an operator?

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: So, 'NOT' is a function, too?

Peck, Jon
Well, how do you feel about

if x eq(x) y=1.

If x is an expression, (x) is also an expression.

Regards,
Jon

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Richard Ristow
Sent: Monday, January 28, 2008 6:41 PM
To: [hidden email]
Subject: [SPSSX-L] So, 'NOT' is a function, too?

In discussing some points of coding with Gene Maguin, I said that,

>. 'Not' is a relational prefix, not a function. Write
>"not sysmis(date(#j)))",
>instead of
>"not(sysmis(date(#j))))"

That agrees with the documentation: from the Command Syntax Reference,

>NOT Logical Operator
>The NOT logical operator reverses the true/false outcome of the
>expression that immediately follows.
>.. The NOT operator affects only the expression that immediately
>follows, unless a more complex logical expression is enclosed in parentheses.

However, both syntactic forms actually work. SPSS 14 draft output:
DATA LIST FREE / CaseID (N2) Datum (F2).
BEGIN DATA
01 1 02 0
END DATA.
RECODE Datum (0=SYSMIS).


STRING IsThere1 IsThere2 (A8).

IF not sysmis(Datum)  IsThere1 = 'Present'.
IF not(sysmis(Datum)) IsThere2 = 'Present'.

LIST.
|-----------------------------|---------------------------|
|Output Created               |27-JAN-2008 22:38:43       |
|-----------------------------|---------------------------|
CaseID Datum IsThere1 IsThere2

    1      1  Present  Present
    2      .

Number of cases read:  2    Number of cases listed:  2


I don't find 'NOT', as a function, documented in the CSR. Was it
implemented initially as a function, and kept in later
implementations where it was also an operator?

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: So, 'NOT' is a function, too?

Richard Ristow
I'd noted saying that,

>>. 'Not' is a relational prefix, not a function. Write
>>"not sysmis(date(#j)))",
>>instead of
>>"not(sysmis(date(#j))))"

and then expressed surprise that, while the former matches the
documentation, the latter also works.

At 12:46 PM 1/29/2008, Peck, Jon set me straight:

>Well, how do you feel about
>
>if x eq(x) y=1.
>
>If x is an expression, (x) is also an expression.

In other words, the latter form, that I took as writing 'NOT' as a
function with a parenthesized argument, also parses correctly with
'NOT' as a prefix operator and "(sysmis(date(#j))" as right argument,
a parenthesized expression.

Sheesh. I'm supposed to get these things.

Thanks, Jon.

-Sheepish,
  Richard

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: So, 'NOT' is a function, too?

King Douglas
Besides his generosity and quick mind, one of the things I've always liked about Richard is his humility.

King Douglas
American Airlines Customer Research

Richard Ristow <[hidden email]> wrote: I'd noted saying that,

>>. 'Not' is a relational prefix, not a function. Write
>>"not sysmis(date(#j)))",
>>instead of
>>"not(sysmis(date(#j))))"

and then expressed surprise that, while the former matches the
documentation, the latter also works.

At 12:46 PM 1/29/2008, Peck, Jon set me straight:

>Well, how do you feel about
>
>if x eq(x) y=1.
>
>If x is an expression, (x) is also an expression.

In other words, the latter form, that I took as writing 'NOT' as a
function with a parenthesized argument, also parses correctly with
'NOT' as a prefix operator and "(sysmis(date(#j))" as right argument,
a parenthesized expression.

Sheesh. I'm supposed to get these things.

Thanks, Jon.

-Sheepish,
  Richard

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD