I have a quite large SPSS database with cases that each have some date
variables in them (date format is dd.mm.yyy). I want to be able to
select cases which have a date variable that falls between two certain
dates (e.g. 01.01.1998 and 31.12.1998). Does anybody know what I
should enter in the selecting cases box to get this result?
I can't define dates as the cases do not go up in date incrementally.
Thank you so much in advance for any help
select if =range(date
variable,date.dmy(1,1,1998),date.dmy(31,12,1998)).
Hi thanks very much
I am entering
SELECT IF = RANGE (var00002,date.dmy(1,1,1998),date.dmy(31,12,1998)).
in the syntax box and keep getting this message in my output:
>Error # 4024 in column 11. Text: =
>The sequence of operators found is invalid. Check the expression for omitted
>or extra operands, operators, and parentheses.
>This command not executed.
Any suggestions?
Thanks so much :)
I'm not sure what you mean by "syntax box". If you are typing the
command into a syntax editor, just get rid of the = sign.
But it sounds like you might be using the Data - Select Cases GUI. If
you are, then the box should contain only this expression:
RANGE (var00002,date.dmy(1,1,1998),date.dmy(31,12,1998))
And you need to check the button to Delete the unselected cases. If
you then exit the dialog via PASTE (rather than Okay), it will
generate syntax similar to what you show above, but without the =
sign.
HTH.
--
Bruce Weaver
bwe...@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/Home
"When all else fails, RTFM."
Select If does not use an equal sign.
The code assumes that var00002 is a "date variable" as a number.
If you only want a particular year, you could use the appropriate
date function to extract the year and compare to 1998.
--
Rich Ulrich
Oh this worked! Thank you so much, you have all been such a big help!
I really appreciate it.