load_from_sas: Load data from SAS 9.4 to R

View source: R/transfer.R

load_from_sasR Documentation

Load data from SAS 9.4 to R

Description

load_from_sas will load data tables from SAS to R; various library connections and pre-processing code can be included prior to data loading to allow SAS to conduct formatting and calculations on its side. Tables are temporarily extracted to the default R installation location, if there are no errors, the table will be deleted from this location upon loading into memory for R. The SAS script and log will have a random number attached to ensure multiple users dont clash onto the same file. Requires a local version of SAS 9.4 which must be accessible from the RStudio instance.

Usage

load_from_sas(
  datalist,
  sas_path = "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe",
  config_file = NULL,
  add_library = "",
  add_code = "",
  convert2csv = FALSE,
  keep_attr = FALSE
)

Arguments

datalist

A string vector of library and tables names in SAS (libname.tablename).

sas_path

File path to SAS 9.4 executable; default set to a rough standard of: C:/Program Files/SASHome/SASFoundation/9.4/sas.exe.

config_file

File path for SAS 9.4 configuration file (e.g. C:/.../SAS9.4_Prod/SASV9.CFG)

add_library

Character string (SAS code) for additional libraries to be mapped (see connect_sas_libraries).

add_code

Character string (SAS code) for additional data formatting and calculations to perform before loading data.

convert2csv

Logical variable (TRUE/FALSE) to indicate if the data exported from SAS should be in csv format.

keep_attr

Logical variable (TRUE/FALSE) to indicate if attribute values should be stripped from the output tables upon loading from SAS.

Value

Dataset(s) based upon the input parameters.

Examples

## Not run: 
load_from_sas(c('LIBNAME1.TBLNAME1', 'LIBNAME2.TBLNAME1'))

## End(Not run)

al-obrien/farrago documentation built on April 14, 2023, 6:20 p.m.