Skip to content

Specify 'length' attribute of variable in XPT file #20

Open
@elimillera

Description

@elimillera

Hello,

I am writing an XPT file and I would like to specify the length attribute of the character variables. Looking at the write.xport function it looks like this is set as max(c(1,nchar(var, "bytes", keepNA=FALSE))). Would you be open to a PR that adds the option to pass an attribute "SASlength" that overrides the length on character variables? I've tested this out and it can be handled similarly to "SASformat".

mtcars2$mpg <- as.character(mtcars2$mpg)
attr(mtcars2$mpg, "SASlength") <- 20
write.xport(mtcars2, file = "test.xpt")

image
Thanks,
Eli

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions