Loading SAS data
IQRloadSASdata.RdUsing 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
sas7bdatorxptdata file.- as.data.frame
 Logical. If
TRUEadata.frameis returned.- noLabels
 Logical. If
TRUElabel attributes are removed.- replaceComma
 If
TRUEthe "," is exchanged for " " - otherwise not.- encoding
 Sets the encoding (e.g.
"UTF-8"): a value ofNULLuses the encoding specified in the file. Use this argument to override it if it is incorrect. Ignored for.xptfiles.
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()
