LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2002)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 22 Oct 2002 09:22:15 -0500
Reply-To:     "MacKechnie, Doug" <dmackechnie@spss.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         "MacKechnie, Doug" <dmackechnie@spss.com>
Subject:      Re: SPSS dates in V10.05 and V11.0.1
Comments: cc: Seumas Rogan <seumasr@martynia.hrp.arizona.edu>
Content-Type: text/plain; charset="US-ASCII"

Hi Seumas,

Here's a thread I sent the list a few months ago that I think both explains the issue and gives you the tools to fix it. Please let me know if you have any questions.

Regards,

Doug MacKechnie Senior Software Support Rep. SPSS, Inc.

________________________ Hi Steve,

There is no "global" method of correcting this data, but you should be able to adjust it reasonably easily using the following command syntax:

IF XDATE.YEAR(datevar) < 1910 datevar = DATE.MDY(XDATE.MONTH(datevar), XDATE.MDAY(datevar), XDATE.YEAR(datevar) + 100). EXE.

You will have to run this IF command once for each date variable whose data requires adjustment. Replace 'datevar' with the name of your date variable, and choose a suitable cutoff point for adding a century (I've used 1910 here).

And as you've discovered, I would absolutely recommend always using a 4-digit year date format, and making sure that the Century Range in Edit->Options->Data is always set to the proper current default of 1933 - 2032.

Now here's what happened and why there can be no 'global' means of correcting it:

SPSS dates are actually stored as numeric floating decimals in the form of the number of seconds that have elapsed between said date and the first day of the Gregorian Calendar. So the various date formats available are just display formats that tell SPSS how to take this massive number of seconds and convert it to something that is actually readable as a date. This date format also lets SPSS know how you are going to be entering the month, day, and year, so that it can tell how to take that information and convert it to the number of seconds for actual storage.

But specifically, SPSS needs to be told how to handle 2-digit year formats, both in terms of processing them on entry and in terms of display. When your data was entered, the Century Range was still set to 1900 - 1999. So when you enter a date with just a 2-digit year such as 1/20/02, SPSS looks at the '02', checks the range, maps it to '1902', and finally stores the date as the number of seconds that means 1/20/1902. Then, because the date variable was set to display as a 2-digit year, it looks at the date it stored, sees that it's '1902', checks the range to see whether it falls into the allowed range for 2-digit years, sees that it does (the range is still set to 1900 - 1999), and displays 1/20/02, 'confident' that the user will know that '02' means '1902', because that is what the Century Range dictates.

If you actually meant the '02' to be '2002' then either the Century Range needed to be adjusted to account for that or you should have entered '2002' and removed all doubt.

What you are experiencing now with the '******' displays is this: starting with later versions of SPSS 10 the installation default setting for the Century Range was changed to 1933 - 2032. So any data that was stored as a year earlier than 1933 is going to have problems being displayed in 2-digit format. If the stored date was 1/20/1902, again, SPSS pulls up the date, converts the seconds, sees that it's '1902', checks that against the 2-digit Century Range, notes that 1902 falls outside the range (now set to 1933 - 2032) and realizes that if it actually displays 1/20/02, the user is going to expect that to mean '2002' -- which is not the date that was stored. So to prevent confusion, it displays '******' instead.

If you change the date variables to any 4-digit year formats they will diplay correctly -- provided that the column is wide enough. If you ever get '******' with a 4-digit format, just widen the column until you can see the whole date.

I hope that all made sense. The point is that this isn't just a formatting or default setting issue, it goes to the preservation of data integrity. If Y2K taught us anything it should at least be never to use 2-digit years unless you are completely certain that the century is being interpreted and stored the way you wish it to be.

Please let me know if you have any other questions or have any difficulty implementing the solution I offered above.

Regards,

-----Original Message----- From: STEVEN HARVEY [mailto:SHARVEY@URC-CHS.COM] Sent: Fri 8/2/2002 11:20 AM To: SPSSX-L@LISTSERV.UGA.EDU Cc: Subject: Date format conversion from v.9 to v.11

Dear list members & colleagues,

We've just upgraded from SPSS version 10 to version 11. I have not customized any settings yet in the new version, I am running it with everything set to default values.

I have many datasets that were entered in v. 9 or 10 or imported into v. 10 from text files. We entered date variables in these datasets in international 8-digit format (dd-mm-yy). When I open them in v.11, the display reads ******** in both the cell and the cell editor. If I change the format to 10-digit international (dd-mm-yyyy), what was originally entered as 7-3-02 (March 7, 2002), the display in the cell and cell editor becomes 7-3-1902. This seems contrary to the explanation in the formatting section of the on-line syntax guide. If I try to change the format to 7- or 9-digit international (dd-mmm-yy or dd-mmm-yyyy), I'm back to nothing but asterisks.

I've also tried changing the century range on the data tab under Edit\Options. This has no effect on previously entered data.

Is there some simple way to convert the v.9-10 format so that it displays correctly in both the cell and cell editor in version 11? I'd like to do this globally, if possible, since some of my datasets include many date variables & updating them one by one would be very time consuming.

Sorry for such a long message to ask what is probably(?) a simple question and which I hope has a simple answer.

Thank you.

Steve Harvey ___________________________________

-----Original Message----- From: Seumas Rogan [mailto:seumasr@martynia.hrp.arizona.edu] Sent: Monday, October 21, 2002 5:02 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: SPSS dates in V10.05 and V11.0.1

Hello everyone!

I had a file which contained date fields in MMDDYY in SPSS 10.0.5. All of the dates occurred in 1997, 1998, 1999, 2000, 2001 or 2002.

I recently upgraded to SPSS 11.0.1 and now have some problems with the date fields. As far as I can tell, all of the dates in 2000, 2001 and 2002 have been changed to 1900, 1901 and 1902.

I understand from the online help that there is a setting that allows the user to specify the century range for 2-digit years, but this does not seem to help me at the moment. I am checking the hardcopies now to make sure that only the year has been changed, i.e., the month and day are correct, as I can write syntax to increment the year by 100 and save as a new date.

I would like to know if anyone else has had the same problem, or if you would have any advice as to why this happened?

Thanks for any advice or comments!

SR

seumasr@hrp.arizona.edu


Back to: Top of message | Previous page | Main SPSSX-L page