Skip to contents

Reads a CDISC Dataset-JSON v1.1 file and writes it as a SAS V5 transport file. All metadata (labels, lengths) is preserved.

Usage

json_to_xpt(json_path, xpt_path, version = 5L)

Arguments

json_path

Path to a .json dataset file.

xpt_path

Output path for the .xpt file.

version

XPT version: 5 (FDA standard, default) or 8.

Value

The output path, invisibly.

Examples

dm <- data.frame(STUDYID = "S1", AGE = 65L, stringsAsFactors = FALSE)
json <- tempfile(fileext = ".json")
xpt <- tempfile(fileext = ".xpt")
write_json(dm, json, dataset = "DM", label = "Demographics")
json_to_xpt(json, xpt)
read_xpt(xpt)
#>   STUDYID AGE
#> 1      S1  65
unlink(c(json, xpt))