Date: Sun, 8 May 2011 00:29:53 -0500
Reply-To: Richard Ristow <firstname.lastname@example.org>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Richard Ristow <email@example.com>
Subject: Re: Reading Date & Time from CSV File
Content-Type: text/plain; charset="us-ascii"; format=flowed
At 09:43 AM 5/7/2011, Phyllis Ann sent me, off list, a spreadsheet
with 50 cases from her data.
I'm delighted that the date problem has been solved, but there's one
puzzlement left -- fortunately, it doesn't have to be resolved for
the work to go forward.
Here are headers and two lines of data from the sheet:
ID from Exit date ID from variable SPSS exit Numeric
excel from Excel SPSS exit_dt dates with value of
from Richard's Excel
SPSS syntax date (WRR)
0001DI40F 7/28/2008 0001DI40F 17741 28-Jul-08 39657
000iu304L 6/1/2008 000iu304L 17684 1-Jun-08 39600
The column "Exit date from Excel" consists of proper Excel date
values. That is, the values *appear* as dates, but they are
*actually* integers -- the number of days from the beginning of the
20th century (with a two-day correction). I've added a last column
that displays the integer values.
But somehow the value that SPSS read ("variable exit_dt from SPSS")
got the numeric values for SAS dates, i.e. days since the start of
1960. I don't see how, if SPSS actually read this spreadsheet, or a
CSV file created from it.
If SPSS read the spreadsheet, those values would normally be read as
SPSS date values; SPSS recognizes that the cells are date-formatted.
Things can go wrong to make SPSS read the numeric values instead
(39657, instead of the date 28-Jul-2008), or to read the displayed
values as character strings ("7/28/2008"). But the SAS numeric values
aren't in the Excel file at all.
I suppose the data was extracted from SAS in some form that was then
read into SPSS, and at that point the fault occurred that made SPSS
get the SAS numeric values of the dates, rather than the date values
as SPSS dates. And then, the Excel spreadsheet was created from the
same extract file from SAS; but this time, the reading went properly
and the dates became proper Excel dates. That, or something similar, anyhow.
It's easy to see why the original questioner didn't consider she
might have SAS date values -- she had only the spreadsheet, where
they AREN'T SAS date values.
-Best wishes to all,
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
For a list of commands to manage subscriptions, send the command