Skip to contents

Writes a local data frame into SAS transport file of version 5. The SAS transport format is an open format, as is required for submission of the data to the FDA.


xportr_write(.df, path, label = NULL, strict_checks = FALSE)



A data frame to write.


Path where transport file will be written. File name sans will be used as xpt name.


Dataset label. It must be <=40 characters.


If TRUE, xpt validation will report errors and not write out the dataset. If FALSE, xpt validation will report warnings and continue with writing out the dataset. Defaults to FALSE


A data frame. xportr_write() returns the input data invisibly.


  • Variable and dataset labels are stored in the "label" attribute.

  • SAS length are stored in the "SASlength" attribute.

  • SAS format are stored in the "SASformat" attribute.

  • SAS type are stored in the "SAStype" attribute.


adsl <- data.frame(
  Subj = as.character(123, 456, 789),
  Different = c("a", "b", "c"),
  Val = c("1", "2", "3"),
  Param = c("param1", "param2", "param3")

  path = paste0(tempdir(), "/adsl.xpt"),
  label = "Subject-Level Analysis",
  strict_checks = FALSE
#> Warning: The following validation checks failed:
#>  Variable `Different` must be 8 characters or less.
#>  Variables `Subj`, `Different`, `Val`, and `Param` cannot contain any lowercase characters.