|
I have an Access data base which contains a time variable
(time_of_occurrence) in hh:mm:ss AM (or PM) format. When I import the
data into SPSS, the AM/PM part is stripped off and a date in dd-mmm-yyyy format
is pre-pended to the time. (In all cases, the date pre-pended is 30-Dec-1899.)
Here’s an example of the data in Access and in SPSS:
Here’s the syntax that I used: GET DATA /TYPE=ODBC /CONNECT='DSN=MS Access Database;DBQ=mydatabase;' /SQL='SELECT TIME_OF_OCCURRENCE FROM [event By
Date and Time]' /ASSUMEDSTRWIDTH=255. CACHE. EXECUTE. I tried to export the time variable to Excel as a work
around and for all cases the value for time_of_occurrence became 00/01/1900.
Obviously, that wasn’t successful. Any
suggestions to import the data correctly would be appreciated. Pat |
|
You could use the XDATE function to extract
just the time value and throw away the meaningless date portion.
I have an Access data base which contains a time variable (time_of_occurrence) in hh:mm:ss AM (or PM) format. When I import the data into SPSS, the AM/PM part is stripped off and a date in dd-mmm-yyyy format is pre-pended to the time. (In all cases, the date pre-pended is 30-Dec-1899.) Here’s an example of the data in Access and in SPSS:
Here’s the syntax that I used: GET DATA /TYPE=ODBC /CONNECT='DSN=MS Access Database;DBQ=mydatabase;' /SQL='SELECT TIME_OF_OCCURRENCE FROM [event By Date and Time]' /ASSUMEDSTRWIDTH=255. CACHE. EXECUTE. I tried to export the time variable to Excel as a work around and for all cases the value for time_of_occurrence became 00/01/1900. Obviously, that wasn’t successful. Any suggestions to import the data correctly
would be appreciated.
|
|
In reply to this post by Cleland, Patricia (EDU)
It looks like Access doesn't have a concept
of a time that doesn't include a date and so assumes a time without a date
is the first day of it's internal notion of year 0.
So use xdate.time to remove the extraneous date, as in: compute newvar=xdate.time(oldvar). formats newvar (time12.2)
You could use the XDATE function to extract just the time value and throw away the meaningless date portion.
I have an Access data base which contains a time variable (time_of_occurrence) in hh:mm:ss AM (or PM) format. When I import the data into SPSS, the AM/PM part is stripped off and a date in dd-mmm-yyyy format is pre-pended to the time. (In all cases, the date pre-pended is 30-Dec-1899.) Here’s an example of the data in Access and in SPSS:
Here’s the syntax that I used: GET DATA /TYPE=ODBC /CONNECT='DSN=MS Access Database;DBQ=mydatabase;' /SQL='SELECT TIME_OF_OCCURRENCE FROM [event By Date and Time]' /ASSUMEDSTRWIDTH=255. CACHE. EXECUTE. I tried to export the time variable to Excel as a work around and for all cases the value for time_of_occurrence became 00/01/1900. Obviously, that wasn’t successful. Any suggestions to import the data correctly
would be appreciated.
|
| Free forum by Nabble | Edit this page |
