selection based on date field

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

selection based on date field

Paul Mcgeoghan
Hi,

I have a date field which has dates of format
30-Mar-2009
31-Mar-2009
01-Apr-2009

How do I do a selection to exclude the date 31-Mar-2009 using Data Select
Cases if condition is satisfied?

Thanks,
Paul

=====================
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: selection based on date field

Clive Downs
Hi Paul

This syntax should do it (ie compare against a literal date value expressed
via DATE.DMY function). Assume your date variable is VAR00001.

USE ALL.
COMPUTE filter_$=( ~ VAR00001=DATE.DMY(31,03,2009)).
VARIABLE LABEL filter_$ ' ~ VAR00001=DATE.DMY(31,03,2009) (FILTER)'.
VALUE LABELS filter_$  0 'Not Selected' 1 'Selected'.
FORMAT filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE .

Regards

Clive.

>I have a date field which has dates of format
>30-Mar-2009
>31-Mar-2009
>01-Apr-2009
>
>How do I do a selection to exclude the date 31-Mar-2009 using Data Select
>Cases if condition is satisfied?
>
>Thanks,
>Paul

=====================
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: selection based on date field

Marks, Jim
In reply to this post by Paul Mcgeoghan
You need to use a condition like

COMPUTE filt_out = datefield NE date.mdy(31,3,2009).
FILTER BY filt_out.

--jim

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Paul McGeoghan
Sent: Thursday, April 16, 2009 4:56 AM
To: [hidden email]
Subject: selection based on date field

Hi,

I have a date field which has dates of format
30-Mar-2009
31-Mar-2009
01-Apr-2009

How do I do a selection to exclude the date 31-Mar-2009 using Data
Select
Cases if condition is satisfied?

Thanks,
Paul

=====================
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: selection based on date field

Clive Downs
In reply to this post by Paul Mcgeoghan
Jim,

Thank you for your filter syntax-  much more economical than my version!

Regards

Clive.

>You need to use a condition like
>
>COMPUTE filt_out = datefield NE date.mdy(31,3,2009).
>FILTER BY filt_out.
>
>--jim
>
>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
>Paul McGeoghan
>Sent: Thursday, April 16, 2009 4:56 AM
>To: [hidden email]
>Subject: selection based on date field
>
>Hi,
>
>I have a date field which has dates of format
>30-Mar-2009
>31-Mar-2009
>01-Apr-2009
>
>How do I do a selection to exclude the date 31-Mar-2009 using Data
>Select
>Cases if condition is satisfied?
>
>Thanks,
>Paul
>
>=====================
>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

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