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

write_sav() - Invalid SPSS file with string length 255 #226

Closed
BurninLeo opened this issue Oct 19, 2016 · 2 comments
Closed

write_sav() - Invalid SPSS file with string length 255 #226

BurninLeo opened this issue Oct 19, 2016 · 2 comments

Comments

@BurninLeo
Copy link

@BurninLeo BurninLeo commented Oct 19, 2016

Haven:write_sav() will produce invalid SPSS files under some circumstances. Here's an example that won't work with SPSS v23. It seems an issue with string that are exactly 255 characters long.

df = data.frame(row.names = c("1","2"))
df$A = 1
df$B = ""
df["2","B"] = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789|123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789|1234567890123456789012345678901234567890123456789|12345"
library(haven)
write_sav(df, "test.sav")

R version 3.2.4 Revised (2016-03-16 r70336)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Package: haven_1.0.0
SPSS 23.0.0.0 (64bit) in unicode mode

Resulting SPSS file:
test.zip

@evanmiller
Copy link
Collaborator

@evanmiller evanmiller commented Oct 22, 2016

Hi, I can confirm the issue. I will post here when a fix is available.

@evanmiller
Copy link
Collaborator

@evanmiller evanmiller commented Oct 22, 2016

@hadley This is fixed here: WizardMac/ReadStat@e4b4c1b

@hadley hadley closed this in 17b488f Oct 27, 2016
@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.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants