compute filter question

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

compute filter question

DeMichele, Matthew
Hi All:

I have another easy question for the list. I've tried to figure this one
out but I'm stumped.

I want to create a filter variable using admission and release dates.
Here is what I came up with. I receive an "incorrect variable name"
error message. The syntax runs without the "|" segment included.

COMPUTE filter_Cohort=( _ADMISSION_DATE1 <= date.dmy(31, 12, 2000)) &
(_RELEASE_DATE1 >= date.dmy(1, 1, 2005)) | (PRISON_RELEASE_DATE =
Missing).

Any suggestions are appreciated.

Thank you,
Matthew

=====================
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: compute filter question

Rick Oliver-3
Try:

MISSING(PRISON_RELEASE_DATE)



Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]




From:        "DeMichele, Matthew" <[hidden email]>
To:        [hidden email],
Date:        01/17/2014 01:47 PM
Subject:        compute filter question
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi All:

I have another easy question for the list. I've tried to figure this one
out but I'm stumped.

I want to create a filter variable using admission and release dates.
Here is what I came up with. I receive an "incorrect variable name"
error message. The syntax runs without the "|" segment included.

COMPUTE filter_Cohort=( _ADMISSION_DATE1 <= date.dmy(31, 12, 2000)) &
(_RELEASE_DATE1 >= date.dmy(1, 1, 2005)) | (PRISON_RELEASE_DATE =
Missing).

Any suggestions are appreciated.

Thank you,
Matthew

=====================
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: compute filter question

peter link
In reply to this post by DeMichele, Matthew
Matthew - I believe this is the same problem you had in your last question -
you can't have x = missing.  It needs to be missing(x) or in your case,
missing(PRISON_RELEASE_DATE).

peter

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
DeMichele, Matthew
Sent: Friday, January 17, 2014 11:43 AM
To: [hidden email]
Subject: [SPSSX-L] compute filter question

Hi All:

I have another easy question for the list. I've tried to figure this one
out but I'm stumped.

I want to create a filter variable using admission and release dates.
Here is what I came up with. I receive an "incorrect variable name"
error message. The syntax runs without the "|" segment included.

COMPUTE filter_Cohort=( _ADMISSION_DATE1 <= date.dmy(31, 12, 2000)) &
(_RELEASE_DATE1 >= date.dmy(1, 1, 2005)) | (PRISON_RELEASE_DATE =
Missing).

Any suggestions are appreciated.

Thank you,
Matthew

=====================
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: compute filter question

Rich Ulrich
In reply to this post by DeMichele, Matthew
Any automatic SPSS variable will start with $.

Using $SYSMIS  might work.

--
Rich Ulrich

----------------------------------------

> Date: Fri, 17 Jan 2014 14:42:32 -0500
> From: [hidden email]
> Subject: compute filter question
> To: [hidden email]
>
> Hi All:
>
> I have another easy question for the list. I've tried to figure this one
> out but I'm stumped.
>
> I want to create a filter variable using admission and release dates.
> Here is what I came up with. I receive an "incorrect variable name"
> error message. The syntax runs without the "|" segment included.
>
> COMPUTE filter_Cohort=( _ADMISSION_DATE1 <= date.dmy(31, 12, 2000)) &
> (_RELEASE_DATE1>= date.dmy(1, 1, 2005)) | (PRISON_RELEASE_DATE =
> Missing).
>
> Any suggestions are appreciated.
>

=====================
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: compute filter question

Rick Oliver-3
$sysmis will work for system-missing numeric variables, but not user-missing.

Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]




From:        Rich Ulrich <[hidden email]>
To:        [hidden email],
Date:        01/17/2014 02:31 PM
Subject:        Re: compute filter question
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Any automatic SPSS variable will start with $.

Using $SYSMIS  might work.

--
Rich Ulrich

----------------------------------------
> Date: Fri, 17 Jan 2014 14:42:32 -0500
> From: [hidden email]
> Subject: compute filter question
> To: [hidden email]
>
> Hi All:
>
> I have another easy question for the list. I've tried to figure this one
> out but I'm stumped.
>
> I want to create a filter variable using admission and release dates.
> Here is what I came up with. I receive an "incorrect variable name"
> error message. The syntax runs without the "|" segment included.
>
> COMPUTE filter_Cohort=( _ADMISSION_DATE1 <= date.dmy(31, 12, 2000)) &
> (_RELEASE_DATE1>= date.dmy(1, 1, 2005)) | (PRISON_RELEASE_DATE =
> Missing).
>
> Any suggestions are appreciated.
>

=====================
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: compute filter question

Richard Ristow
In reply to this post by Rich Ulrich
At 03:26 PM 1/17/2014, Rich Ulrich wrote:

>Any automatic SPSS variable will start with $.
>
>Using (PRISON_RELEASE_DATE =$SYSMIS)  might work.

No, it won't. SPSS comparison results are THREE-valued: True, False,
and Missing. Comparison of a missing value with anything returns
"Missing". The result of the comparison will have nothing to do with
whether PRISON_RELEASE_DATE has a valid value or not.

Somewhat confusingly, SPSS treats Missing and False in (I believe)
all contexts except DO IF / ELSE IF. I've frequently noted this as a
deficiency.

=====================
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