Date: Thu, 20 Oct 2005 16:51:06 -0500
Reply-To: "Peck, Jon" <peck@spss.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Peck, Jon" <peck@spss.com>
Subject: Re: CCYYMMDD Input Date Help
Content-Type: text/plain; charset="us-ascii"
Answer below.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Scott Terry
Sent: Thursday, October 20, 2005 11:07 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: [SPSSX-L] CCYYMMDD Input Date Help
Hi Gang:
I've just installed SPSS 14 and want to take advantage of the new and
improved date functions.
My business works with large databases. So the data extracts I receive
typically have dates written in a numeric, CCYYMMDD format. Doing so is
compact (no delimiters) and sorting will always rank order the dates.
So my question is ...
How do I read these types of dates into a SPSS date field?
In looking at all the formats, it appears that a CCYYMMDD format is
about the only one missing. Seems strange to me. And the closest one
seems to be a jdate format. But it appears that this format eliminates
the month ... working only when a year and a numeric day (out of 365?)
is present.
[>>>Peck, Jon] You are right that SPSS lacks this as a built-in format (I agree that it should have it), but there is an easy solution
Read your 8-byte field in as a string (A8). Use the Data>Date/Time wizard to convert it to whatever date format you want within SPSS. Paste the syntax for repeated use.
You will see in the list of input formats for converting a string to a date that yyyymmdd is present. You can see how this is done from the generated syntax.
Note that once it is a true SPSS date variable, it will sort correctly regardless of the format.
Regards,
Jon Peck
Any help would be appreciated and regards.
Scott Terry
800.733.1817, x2190
Hyphos360
19337 US Hwy 19 N, Ste 500
Clearwater, FL 33764
www.hyphos360.com
H | Y | P | H | O | S 3 6 0