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

Invalid date string #230

Closed
pkq opened this Issue Oct 21, 2016 · 10 comments

Comments

Projects
None yet
3 participants
@pkq
Copy link
Contributor

pkq commented Oct 21, 2016

I'm getting an Invalid date string error when attempting to read in an SPSS file:

Invalid date string (length=9): 11 FEB 1412:35:06
Error in eval(substitute(expr), envir, enclos) :
Failed to parse file_name.sav: The file's timestamp string is invalid.

I'm guessing it has to do with the fact that there's no space between the year and timestamp, but don't have any idea what would cause it, or how to fix it, and unfortunately, I'm not able to share the file. Any guidance is appreciated. Thanks!

@evanmiller

This comment has been minimized.

Copy link
Contributor

evanmiller commented Oct 21, 2016

Hi, do you know what program / version produced the SPSS file?

@pkq

This comment has been minimized.

Copy link
Contributor

pkq commented Oct 25, 2016

It was produced using SPSS, but I'm not sure which version it was. The file is a couple years old, so I'm guessing SPSS 20 or 21. The thing is, I'm almost positive I was able to read in this same file using an earlier version of haven. Has haven gotten more strict about requiring a valid timestamp? If so, is there any way to override this restriction?

@evanmiller

This comment has been minimized.

Copy link
Contributor

evanmiller commented Oct 26, 2016

Yes the underlying library (ReadStat) has become more strict with regard to timestamps. It actually looks like the issue is with the case of the month (ReadStat was expecting "Feb", not "FEB"). I will get this fixed soon.

@evanmiller

This comment has been minimized.

Copy link
Contributor

evanmiller commented Oct 26, 2016

Ok, this is fixed in ReadStat here: WizardMac/ReadStat@688e565

@pkq

This comment has been minimized.

Copy link
Contributor

pkq commented Oct 26, 2016

Awesome, thanks for the prompt resolution! I'm guessing this requires an update to haven before it works in R (a la #216)?

@evanmiller

This comment has been minimized.

Copy link
Contributor

evanmiller commented Oct 26, 2016

I think there's an update_readstat script or command so you don't have to wait -- this used to be documented in the README, but I don't see it now.

@tklebel

This comment has been minimized.

Copy link
Contributor

tklebel commented Oct 26, 2016

Hadley moved it to a function: beab227

You should be able to call it like this: haven:::update_readstat(). Note however that you would need to clone the repository first for this to work.

@pkq

This comment has been minimized.

Copy link
Contributor

pkq commented Oct 26, 2016

It looks like haven:::update_readstat() worked, but I'm still getting the same The file's timestamp string is invalid error. Is there a way to confirm that I actually have the latest version of readstat?

@evanmiller

This comment has been minimized.

Copy link
Contributor

evanmiller commented Oct 26, 2016

Can you send me the SAV file that's failing? I can check it on my end. Verifying the ReadStat version can be a little complicated since in the past haven has sometimes omitted some of the source files.

@hadley hadley closed this in 17b488f Oct 27, 2016

@pkq

This comment has been minimized.

Copy link
Contributor

pkq commented Oct 31, 2016

Not sure what I was doing wrong, but updating to the Github version oh haven worked. Thanks @evanmiller!

@lock lock bot locked and limited conversation to collaborators Jun 26, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.