Date: Wed, 10 May 2006 08:16:29 -0500
Reply-To: "Beadle, ViAnn" <viann@spss.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Beadle, ViAnn" <viann@spss.com>
Subject: Re: Compute statement involving dates
Content-Type: text/plain; charset="us-ascii"
Sorry, I don't know about any differences between Excel on the Mac and Excel on the PC WRT dates. I do know that Excel's base date is January 1, 1900 and SPSS seems to resolve that OK.
-----Original Message-----
From: Ian Martin [mailto:ianmartin@mac.com]
Sent: Wednesday, May 10, 2006 8:01 AM
To: SPSSX (r) Discussion; Beadle, ViAnn
Subject: Re: Compute statement involving dates
ViAnn,
How does SPSS handle the 4-year 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 date-formatted 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: SPSSX-L@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
> 31-DEC-1980, 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 31-DEC-1980) 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 31-DEC-1980) to get a calculated spss
> date.
> You can plug the resulting value into syntax to perform calculations.
> This is sort of an excel work-around, 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:SPSSX-L@LISTSERV.UGA.EDU] On Behalf
> Of
> [Ela Bonbevan]
> Sent: Friday, May 05, 2006 12:22 PM
> To: SPSSX-L@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
>
>
|