Date: Wed, 10 May 2006 09:00:40 0400
ReplyTo: Ian Martin <ianmartin@MAC.COM>
Sender: "SPSSX(r) Discussion" <SPSSXL@LISTSERV.UGA.EDU>
From: Ian Martin <ianmartin@MAC.COM>
Subject: Re: Compute statement involving dates
InReplyTo: <AC7C0EC28F84ED43AA2F943F1E62EB6D01036D71@hqemail2.spss.com>
ContentType: text/plain; charset=USASCII; format=flowed
ViAnn,
How does SPSS handle the 4year difference in dates as coded by
excel:mac and excel:pc? I have run afoul of this "feature" in excel
when moving date variables from one platform to another, all within
excel.
Just curious...
Ian.
On 05 May, 2006, at 2:21 PM, Beadle, ViAnn wrote:
> To Greg:
> Ela mentions nothing about Excel. But I wonder why you have to do
> anything to your dates when reading in your Excel sheet? If it's a
> date in Excel, it's a dateformatted variable in SPSS.
>
> To Ela:
> Make sure your variables are dates and not strings masquerading as
> dates. If they are strings, use the number function specifying an
> output format as date11 to create a date variable. You can then test
> your dates in the usual way:
> if (datetr ge datestart and datetr lt dateend) newvar=1
>
> ________________________________
>
> From: SPSSX(r) Discussion on behalf of Greg Katz
> Sent: Fri 5/5/2006 12:21 PM
> To: SPSSXL@LISTSERV.UGA.EDU
> Subject: Re: Compute statement involving dates
>
>
>
> Ela,
> I have found that to perform calculations the program needs dates
> formatted in spss time which is measured in seconds. The display may
> say
> 31DEC1980, but it considers the numeric value to be 12566448000 .
> I have a spreadsheet I use to run calculations and convert standard
> date
> formats into spss time. The conversion is number of steps but fairly
> simple.
> Step 1. Take the date you need and subtract it from a reference date
> (like 31DEC1980) to calculate your days difference (excel can do this
> calculation).
> Step 2. Take that number and multiply it by 86400 (the number of
> seconds
> in a day) to get the date difference in seconds.
> Step 3. Then use that number (add or subtract) with your reference spss
> date value (like 12566448000 aka 31DEC1980) to get a calculated spss
> date.
> You can plug the resulting value into syntax to perform calculations.
> This is sort of an excel workaround, but I hope it helps.
>
> Greg Katz
> Research Assistant
> Center for Social Organization of Schools
> Johns Hopkins University
> 3003 N. Charles Street Suite 200
> Baltimore, Maryland 21218
> tel. 410.516.6796
> fax. 410.516.8890
>
> Original Message
> From: SPSSX(r) Discussion [mailto:SPSSXL@LISTSERV.UGA.EDU] On Behalf
> Of
> [Ela Bonbevan]
> Sent: Friday, May 05, 2006 12:22 PM
> To: SPSSXL@LISTSERV.UGA.EDU
> Subject: Compute statement involving dates
>
> I want to create a variable which indicates if the date in one
> field "datetr" occured in the time that spanned between two other
> dates "datestart" and "dateend". Is this possible to do? If datetr
> does
> fall between the dates, I wanted it to code the case as 1 on the new
> variable. I have tried a few compute statments involving greater than
> and
> less than but none of them seem to work.
>
> Many thanks
> Diane
>
>
