Read all .sas7bdat
files in a directory. Formats can be applied from a procformat.sas
SAS file, from a .
Usage
read_all_sas(
path,
...,
format_file = "procformat.sas",
clean_names_fun = NULL,
subdirectories = FALSE,
datetime_extraction = "guess",
verbose = getOption("edc_read_verbose", 1)
)
Arguments
- path
[
character(1)
]
the path to the directory containing all.sas7bdat
files.- ...
unused
- format_file
[
character(1)
]
the path to the file that should be used to apply formats. See details. UseNULL
to not apply formats.- clean_names_fun
[
function
]
a function to clean column names, e.g. tolower,janitor::clean_names()
,...- subdirectories
[
logical(1)
]
whether to read subdirectories- datetime_extraction
[
POSIXt(1)
]
the datetime of the data extraction. Default to the most common date of last modification indirectory
.- verbose
[
numeric(1)
]
one ofc(0, 1, 2)
. The higher, the more information will be printed.
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 FORMATa catalog file (
.sas7bcat
)or a data file (
.csv
or.sas7bdat
) containing 3 columns: the SAS format name (repeated), each level, and its associated label. Useoptions(edc_var_format_name="xxx", edc_var_level="xxx", edc_var_label="xxx")
to specify the names of the columns.