Skip to contents

Converts R table into a table in the current SAS session. R tables must only have logical, integer, double, factor, character, POSIXct, or Date class columns.

Usage

sas_from_r(x, table_name, libref = "WORK")

Arguments

x

data.frame; R table.

table_name

string; Name of table to be created in SAS.

libref

string; Name of libref to store SAS table within.

Value

data.frame; x.

Details

SAS only has two data types (numeric and character). Data types are converted as follows:

  • logical -> numeric

  • integer -> numeric

  • double -> numeric

  • factor -> character

  • character -> character

  • POSIXct -> numeric (datetime)

  • Date -> numeric (date)

Examples

if (FALSE) { # \dontrun{
sas_connect()
sas_from_r(mtcars, "mtcars")
} # }