I am trying to select cases of students who completed a
course of study prior to, for example, 17-MAY-2007. How can this be performed
using the SELECT IF command—it is not accepted as a string variable
(using single quotes) or number (without quotes). Thanks for any help you can provide. Arthur
Kramer |
Hi Arthur,
The issue is that your date variable is stored as a string. I suggest that you convert the string variable to a date variable. Take a look at the ALTER TYPE command and you can also search the listserv for countless examples of converting dates from string to date variables. Once this is done, you can use something like this: SELECT IF CompleteDate<DATE.MDY(5,17,2007). EXECUTE. I hope this helps. -Ariel On Fri, Feb 18, 2011 at 3:14 PM, Arthur Kramer <[hidden email]> wrote:
|
Thanks, Ariel, but see in the data editor/variable view that the
variable is date format. I think what I may have to do is convert the dates to
seconds since Oct 14, 1582, which is something like 13 billion seconds. Arthur Kramer From: Ariel Barak [mailto:[hidden email]]
Hi Arthur, On Fri, Feb 18, 2011 at 3:14 PM, Arthur Kramer <[hidden email]> wrote: I
am trying to select cases of students who completed a course of study prior to,
for example, 17-MAY-2007. How can this be performed using the SELECT IF
command—it is not accepted as a string variable (using single quotes) or number
(without quotes). Thanks
for any help you can provide. Arthur
Kramer |
In reply to this post by Arthur Kramer
Something like this:
Select if date GE date.mdy(5,1,2007) Will permanently delete all cases prior to 1 may 2007. Jim From: SPSSX(r) Discussion <[hidden email]> To: [hidden email] <[hidden email]> Sent: Fri Feb 18 15:56:49 2011 Subject: Re: selecting cases with a date variable Thanks, Ariel, but see in the data editor/variable view that the
variable is date format. I think what I may have to do is convert the dates to
seconds since Oct 14, 1582, which is something like 13 billion seconds. Arthur Kramer From: Ariel Barak [mailto:[hidden email]]
Hi Arthur, On Fri, Feb 18, 2011 at 3:14 PM, Arthur Kramer <[hidden email]> wrote: I
am trying to select cases of students who completed a course of study prior to,
for example, 17-MAY-2007. How can this be performed using the SELECT IF
command—it is not accepted as a string variable (using single quotes) or number
(without quotes). Thanks
for any help you can provide. Arthur
Kramer |
In reply to this post by Arthur Kramer
(17-MAY-2007 = 13398739200) if you have an other date, use your date formatted variable and check it. solution: IF (date2 <= 13398739200) test=1. EXECUTE. regards
Dr. Frank Gaeth
|
Administrator
|
The method solution Jim Marks posted is far more transparent, IMO. I.e.,
select if datevar LE date.mdy(5,17,2007).
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Free forum by Nabble | Edit this page |