SPSS Export SDATE19 Date Problem

Mehr
3 Jahre 10 Monate her - 3 Jahre 10 Monate her #99556 von petert
petert erstellte das Thema SPSS Export SDATE19 Date Problem
I have a bunch of surveys. They are all set to automatically contain their submitdate, startdate and datestamp. All of these values correctly arrive in SPSS as expected.

However, all dates which I have as part of the actual survey fail to import into SPSS. Looking at the .sps and .csv files, it's clear that the difference between the dates which work and those that don't is their variable type declaration in the .sps file, and the time format in the .csv file.

So, the auto dates are variable type:

V3 DATETIME23.2
...
V6 DATETIME23.2
V7 DATETIME23.2
...
V11 SDATE19.

The SDATE19 variables fail to import correctly. In the .csv file the DATETIME23.2 look like this:
'02-09-2013 10:41:45'

While the SDATE19 look like this:
'2013-09-29 00:00:00'

Now that looks like a proper date, but SPSS chokes every time on it. I just want to change the SPSS export do all dates like DATETIME23.2, and not change to SDATE when it comes to user entered data.

The *really* confusing part, is that the database shows them as exactly the same data types. (See attachments). So why does the export engine switch from DATETIME23.2 to SDATE19 when the data type and data itself is identical.

I have experimented with altering the date format at both the question and survey levels with no change in the SPSS export
behavior.

Thoughts appreciated.



Anhang:
Letzte Änderung: 3 Jahre 10 Monate her von petert. Begründung: .dat --> .csv

Bitte Anmelden um der Konversation beizutretten.

Mehr
3 Jahre 10 Monate her #99573 von mdekker
mdekker antwortete auf das Thema: SPSS Export SDATE19 Date Problem
Can you please file a bug report for this and include a simple survey demonstrating the problem?

The sdate format is a sortable date (yyyy-mm-dd) but apparently this can not hold time. Not really sure why this is a problem now, could be related to spss version. The datetime format is dd-mm-yyyy hh:mm:ss so you can not just change the variable declaration, also the csv data should be reformatted.

---
Menno Dekker

Bitte Anmelden um der Konversation beizutretten.

Mehr
3 Jahre 10 Monate her - 3 Jahre 10 Monate her #99578 von petert
petert antwortete auf das Thema: SPSS Export SDATE19 Date Problem
Well, at least I found why certain field types are handled differently.

application/helpers/export_helper.php line 415-416 says:
if ($fieldname=='submitdate' || $fieldname=='startdate' || $fieldname == 'datestamp') {
            $fieldtype = 'DATETIME23.2';

By adding my own column names to the line like this:
if ($fieldname=='submitdate' || $fieldname=='startdate' || $fieldname == 'datestamp' || $fieldname == '617976X218X3433') {

I was able to get a correct export dump.

Looking at line 340 I find:
'D'=>Array('name'=>'Date','size'=>10,'SPSStype'=>'SDATE'),

So, that's where the action is happening, and explains the inconsistency.
Letzte Änderung: 3 Jahre 10 Monate her von petert. Begründung: bad code flag

Bitte Anmelden um der Konversation beizutretten.

Mehr
3 Jahre 10 Monate her #99580 von petert
petert antwortete auf das Thema: SPSS Export SDATE19 Date Problem
Quick hack fix: Change line 340 in applications/helpers/export_helper.php to:

Old:
'D'=>Array('name'=>'Date','size'=>10,'SPSStype'=>'SDATE'),

New:
'D'=>Array('name'=>'Date','size'=>10,'SPSStype'=>'DATETIME23.2'),

Result in all dates being exported as DATETIME23.2.

Bitte Anmelden um der Konversation beizutretten.

Haben Sie schon bei unserer Kundenumfrage mitgemacht?

Verpassen Sie nicht Ihre Chance auf tolle Preise.

Klicken sie hier um teilzunehmen:

Jetzt starten

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten