Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

'Select if' using date variables

255 views
Skip to first unread message

Robert Kyffin

unread,
Sep 15, 1998, 3:00:00 AM9/15/98
to
Right, I've ploughed through the manuals and had several unsuccessful
attempts at resolving this probably straightforward question:

How can I select cases based on a date format variable (eg. ge 01-JAN-97
and lt 01-JAN-98)?

Any guidance would be very gratefully received (please respond by email -
thanks)!!

Rob Kyffin

Neila Nessa

unread,
Sep 15, 1998, 3:00:00 AM9/15/98
to
Well,

"I've ploughed through the manuals "

The fact that you have done the RTFM thing ....but hey.. slow down,
look at the section on date and time !

SELECT IF RANGE(yourdate, Date.mdy(1,1,1997),Date.mdy(1,1,1998)).
Or
SELECT IF XDATE.YEAR(Yourdate) = 1997 .

"(please respond by email -thanks)!!"

SORRY Robert, come back to the newsgroup and get the answer or tune
into dejanews when it becomes that important!

*** This is just one of my pet-peeves ! <repeat offenders get bozo
filtered!!!>***

All the best, Neila


Robert Kyffin wrote in message ...

Johannes Hardmeier

unread,
Sep 16, 1998, 3:00:00 AM9/16/98
to
SPSS represents date-variables internally as numbers. So
if you do a 'select cases' you can't use
date > "1.1.90"
but you do have to convert this:
date > DATE.DMY(1,1,90) and date < DATE.DMY(1,1,91)

Jo Hardmeier
SPSS (Schweiz) AG


-----Ursprüngliche Nachricht-----
Von: Robert Kyffin [mailto:rob...@RCOG.CMHT.NWEST.NHS.UK]
Gesendet am: Dienstag, 15. September 1998 15:11
An: SPS...@UGA.CC.UGA.EDU
Betreff: 'Select if' using date variables

JeffJ47192

unread,
Sep 16, 1998, 3:00:00 AM9/16/98
to

Without syntax, I've done this with the goofy step of computing a new variable:

date1 = date +1 - 1

The result is all the dates get recoded to numbers in a second variable and you
can tell which numbers to select.

Once you know the number for a particular date, you can delete the dummy
variable. The select if with the number will work off the initial date
variable which apparently is stored as a number even though it appears as a
date.

Jeff 9/16/98

0 new messages