Skip to content

write_dta support for long string (strL)? #437

@deribo

Description

@deribo

I need to process a .json containing logdata into a .dta file. The file itself contains a handful of string variables exceeding 5000 and more characters.

As Stata (since Stata 13) supports long string variables (strL variable) and haven() supports long string at least in write_sav() I wanted to ask if it is in any way possible to write strL-variables with haven (haven't found anything on this)? If not if there's support for this planned in the future?

Bests

library(haven)

longFun <- function(n) {
  do.call(paste0, replicate(5000, sample(LETTERS, n, TRUE), FALSE))
}

longString <- data.frame(V1 = longFun(1), stringsAsFactors = F)
                         
write_dta(longString, paste0(tempdir(), "\\longString.dta"))
#> Error in write_dta_(data, normalizePath(path, mustWork = FALSE), version = stata_file_format(version)): Writing failure: A provided string value was longer than the available storage size of the specified column.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions