Selecting Date

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

Selecting Date

Keval Khichadia
Hi,
 
I am trying to select all dates less than a given date (which varies according to which term I am extracting data for).
 
I have the following syntax:
 
DEFINE !GPADate () '063009'  !ENDDEFINE.
 
define !G () !unquote (!eval(!GPADate)) !enddefine.
select if End_Date <= !G.
 
When I use this syntax all the cases disappear even though there are lots of cases which have dates less than the entered date. I have not really worked with date or time data in SPSS so am wondering if maybe I need to convert it into a different format first?
 
Thanks in advance,
 
Keval

Reply | Threaded
Open this post in threaded view
|

Re: Selecting Date

Albert-Jan Roskam
Hi,

What date does "063009" represent? June 30 2009?
I believe the syntax is something like:
select if ( end_date lt date.dmy(30, 06, 2009) ).

Cheers!!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Before you criticize someone, walk a mile in their shoes, that way
when you do criticize them, you're a mile away and you have their shoes!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--- On Fri, 10/16/09, Keval Khichadia <[hidden email]> wrote:

> From: Keval Khichadia <[hidden email]>
> Subject: [SPSSX-L] Selecting Date
> To: [hidden email]
> Date: Friday, October 16, 2009, 7:01 PM
> Hi,
>
> I am trying to select all dates less than a given date
> (which varies according to which term I am extracting data
> for).
>
> I have the following syntax:
>
> DEFINE !GPADate
> () '063009'  !ENDDEFINE.
>
> define !G () !unquote (!eval(!GPADate))
> !enddefine.
> select if End_Date <= !G.
>
> When I use this syntax all the cases disappear even
> though there are lots of cases which have dates less than
> the entered date. I have not really worked with date or time
> data in SPSS so am wondering if maybe I need to convert it
> into a different format first?
>
> Thanks in advance,
>
> Keval
>
>
>
>
>

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