Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: variables with DATE and DATETIME formats not read correctly in PSPP #211

Closed
ofajardo opened this issue Aug 28, 2020 · 4 comments
Closed
Labels

Comments

@ofajardo
Copy link

It has been reported here that if one writes a sav file with variables with format DATE and DATETIME, those are not read correctly in PSPP (read as plain numbers) with some error messages about wrong print format. Interestingly TIME is is read correctly.

However the same file is read correctly in SPSS and the variables are formatted as expected.

At a first glance this looks to me like an issue in PSPP, however if I understood correctly both PSPP and Readstat use the same file specification (this one?) and therefore I would assume that what Readstat writes should be compatible with PSPP?

What's your opinion on the topic?

@evanmiller
Copy link
Contributor

Hi, yes we both use the same specification that you linked. However, there are sometimes small differences (and bugs) in the implementations since the code bases are completely independent. A common issue with formats is that new versions of SPSS sometimes add new formats, and ReadStat and PSPP have to (separately) add support for them.

Based on the link it looks like PSPP somehow removed support for the DATETIME8 format. It's possible that PSPP has other expectations about DATETIME format, e.g. the width has to be a certain value. The IBM documentation for instance states that the width must be at least 17:

https://www.ibm.com/support/knowledgecenter/SSLVMB_sub/statistics_reference_project_ddita/spss/base/syn_date_and_time_date_time_formats.html

So maybe try supplying DATETIME17 to ReadStat.

@ofajardo
Copy link
Author

Yes, indeed that was the issue. Both DATETIME17 and DATETIME20 work, so I choose the last one, and DATE11. That works in both PSPP and SPSS.

thanks!

@evanmiller
Copy link
Contributor

Glad to hear it. I have added some useful defaults to prevent these situations in the future.

@ofajardo
Copy link
Author

just tested the latest code on dev and the defaults work great (meaning I can pass DATE and DATETIME again)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants