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

Haven splits a character string longer than 255 characters when exported as part of a data frame, does not when exported as a single variable #757

Open
sjkiss opened this issue Jun 12, 2024 · 0 comments
Labels
bug an unexpected problem or unintended behavior readstat

Comments

@sjkiss
Copy link

sjkiss commented Jun 12, 2024

I have a dataset that has a string variable that has values up to 588 characters.

When I export the dataset to SAV, that variable is split at the 255 character limit. When I restrict the dataset to include only that variable, it does not.

I've tried my best to make a reproducible example. This will create two SAV files in a home path, sorry about that.
I could really use some help to solve this.

library(haven)
library(tidyverse)
on18<-read_sav(file="https://github.com/sjkiss/Ontario_2018/raw/main/Data/Ontario%20ES%202018%20LISPOP.sav")
nchar(on18$indivfinfeel) %>% 
summary()
on18 %>% 
  write_sav(., path="~/test.sav")
on18 %>% 
  select(indivfinfeel) %>% 
  write_sav(., path="~/test2.sav")
Screenshot 2024-06-12 at 2 42 08 PM Screenshot 2024-06-12 at 2 41 59 PM
@gorcha gorcha added readstat bug an unexpected problem or unintended behavior labels Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior readstat
Projects
None yet
Development

No branches or pull requests

2 participants