Loading SAS data
IQRloadSASdata.Rd
Using the haven package to load SAS data: Reading supports both sas7bdat and xpt files.
IQRloadSASdata(
data_file,
as.data.frame = TRUE,
noLabels = TRUE,
replaceComma = TRUE,
encoding = NULL
)
Arguments
- data_file
Path to the
sas7bdat
orxpt
data file.- as.data.frame
Logical. If
TRUE
adata.frame
is returned.- noLabels
Logical. If
TRUE
label attributes are removed.- replaceComma
If
TRUE
the "," is exchanged for " " - otherwise not.- encoding
Sets the encoding (e.g.
"UTF-8"
): a value ofNULL
uses the encoding specified in the file. Use this argument to override it if it is incorrect. Ignored for.xpt
files.
Value
data frame Variable labels are stored in the "label" attribute of each variable. It is not printed on the console, but the RStudio viewer will show it.
Details
Some arguments from haven::read_sas are disabled on purpose as there are till bugs with them ... for now only use it for importing SAS files :)
Removing "," in character columns by default (can be switched off)
See also
Other SAS:
getLabels_dataframe()
,
unlabel_dataframe()