-
Notifications
You must be signed in to change notification settings - Fork 115
Closed
Labels
reprexneeds a minimal reproducible exampleneeds a minimal reproducible example
Description
The specification for SAS Transport (https://support.sas.com/techsup/technote/ts140.pdf) provides that each dataset may have a label, not to be confused with column labels. haven::read_xpt() honors these where they exist, but write_xpt() does not (at least, does not react to attribute 'label' and apparently does not support alternative mechanism of supplying same). 'label' is not to be confused with 'name' which is supported (but cannot contain spaces ... consider adding that to documentation). I have not tried CRAN version 2.3.1 but there are no changes in documentation. I'd like to see data.frame 'label' written by write_xpt() to wherever read_xpt() is retrieving it.
library(SASxport) # 1.6.0
library(haven) # 2.1.0
library(magrittr)
label(mtcars) <- 'My Cars'
mtcars %>% write.xport(file = 'SASxp.xpt')
mtcars %>% write_xpt('haven.xpt')
'SASxp.xpt' %>% read.xport %>% attributes %$% label # "My Cars"
'haven.xpt' %>% read.xport # no SAS header! (different problem)
'SASxp.xpt' %>% read_xpt %>% attributes %$% label # "My Cars"
'haven.xpt' %>% read_xpt %>% attributes %>% names # no label
Metadata
Metadata
Assignees
Labels
reprexneeds a minimal reproducible exampleneeds a minimal reproducible example