Reads a SAS transport file (.xpt) and integrates with mariposa's tagged
NA system. Handles both native SAS special missing values and user-specified
numeric missing codes (via tag.na). Transport files are a
platform-independent SAS data format commonly used for FDA submissions and
data exchange.
Arguments
- path
Path to a SAS transport file (
.xpt).- tag.na
Numeric vector of values to treat as missing (e.g.,
c(-9, -8, -42)). These values will be converted to tagged NAs across all numeric variables. Default:NULL(only detect native SAS special missing values).- verbose
If
TRUE, prints a message summarizing how many variables contain tagged missing values.
Value
A tibble with the SAS data. See read_sas() for details on
tagged NA handling.
Details
SAS transport files support the same special missing values as
.sas7bdat files (.A-.Z, ._). This format is self-contained and
does not require a separate catalog file for value labels.
When tag.na is used, untag_na() can recover the original numeric codes.
See also
read_sas(), na_frequencies(), strip_tags(), untag_na(),
haven::read_xpt()
Other data-import:
na_frequencies(),
read_por(),
read_sas(),
read_spss(),
read_stata(),
read_xlsx(),
strip_tags(),
untag_na()
Examples
if (FALSE) { # \dontrun{
# Read transport file with native missing values
data <- read_xpt("survey.xpt")
# Read with numeric missing codes
data <- read_xpt("survey.xpt", tag.na = c(-9, -8, -42))
na_frequencies(data$income)
} # }
