Skip to contents

Read all .xpt files in a directory (unzipped TrialMaster archive).
If 7zip is installed, you should probably rather use read_trialmaster() instead.
If a procformat.sas file exists in the directory, formats will be applied.

Usage

read_all_xpt(
  path,
  ...,
  format_file = "procformat.sas",
  datetime_extraction = "guess",
  subdirectories = FALSE,
  verbose = getOption("edc_read_verbose", 1),
  clean_names_fun = NULL,
  directory = "deprecated",
  key_columns = "deprecated"
)

Arguments

path

[character(1)]
the path to the directory containing all .xpt files.

...

unused

format_file

[character(1)]
the path to the file that should be used to apply formats. See section "Format file" below. Use NULL to not apply formats.

datetime_extraction

[POSIXt(1)]
the datetime of the data extraction. Default to the most common date of last modification in path.

subdirectories

[logical(1)]
whether to read subdirectories

verbose

[numeric(1)]
one of c(0, 1, 2). The higher, the more information will be printed.

clean_names_fun

[Deprecated] use edc_clean_names() instead.

directory

deprecated in favour for path

key_columns

deprecated

Value

a list containing one dataframe for each .xpt file in the folder, the extraction date (datetime_extraction), and a summary of all imported tables (.lookup).

Format file

format_file should contain the information about SAS formats. It can be either:

  • a procformat.sas file, containing the whole PROC FORMAT

  • or a data file (.csv or .sas7bdat) containing 3 columns:

    • FMTNAME the SAS format name (repeated)

    • START the variable level

    • LABEL the label associated to the level

    You can get this datafile from SAS using PROC FORMAT with option CNTLOUT. Otherwise, you can use options(edc_var_format_name="xxx", edc_var_level="xxx", edc_var_label="xxx") to specify different column names.

See also

Other EDCimport reading functions: read_all_csv(), read_all_sas(), read_trialmaster()