Date: Thu, 5 May 2011 17:53:24 +0200
Reply-To: Marta García-Granero <mgarciagranero@gmail.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Marta García-Granero <mgarciagranero@gmail.com>
Subject: Re: Reading Date & Time from CSV File
In-Reply-To: <1304601966572-4372785.post@n5.nabble.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi PAC:
I created (using Excel) a short CSV file with the following data:
id;mydate
1;04/01/2008
2;09/30/2010
(the two example dates you mentioned in your message) and read it into
SPSS (15) using:
GET DATA /TYPE = TXT
/FILE = 'C:\Documents and Settings\MartaGG\Escritorio\Datasample.csv'
/DELCASE = LINE
/DELIMITERS = ";"
/ARRANGEMENT = DELIMITED
/FIRSTCASE = 2
/IMPORTCASE = ALL
/VARIABLES = id F1.0 mydate ADATE10.
CACHE.
EXECUTE.
And the dates were OK. Have you taken a look at your CSV file using a
text editor?
HTH,
MArta GG
El 05/05/2011 15:26, cumminpa escribió:
> This is my first time posting, so I apologize in advance if the solution to
> my problem is already posted; I looked and could not find it. My SPSS file
> was created from a csv file with dates formatted at MM/DD/YYYY, but in SPSS
> it comes ups as 5 digits ranging from 17623 to 18633. The dates should be
> from about 04/01/2008 to 09/30/2010. I went to the SPSS website and the
> posted suggestion was:
>
> COMPUTE NEWDATE = DATE.MDY(1,1,1900) +( (excdate - 2) * 24 * 60 * 60).
> FORMATS NEWDATE (DATE14).
> EXECUTE.
>
> where "excdate" is the current date variable. This did convert to the date
> format, but it is about 60 years earlier that it should be (i.e.,
> 1948-1950). The SPSS suggested solution is for an excel file import and by
> file was in csv. I don't know enough about imports to know if that could be
> the problem.
>
> Any and all suggestions and help would be appreciated!
>
> PAC
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Reading-Date-Time-from-CSV-File-tp3381430p4372785.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
=====================
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
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
|