sas_to_r: Convert SAS table to R

View source: R/to-r.R

sas_to_rR Documentation

Convert SAS table to R

Description

Converts table from current SAS session into a R data.frame.

Usage

sas_to_r(table_name, libref = "WORK")

Arguments

table_name

string; Name of table in SAS.

libref

string; Name of libref SAS table is stored within.

Details

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

  • numeric -> double

  • character -> character

  • numeric (datetime, timezones are lost) -> POSIXct

  • numeric (date) -> POSIXct

In the conversion process dates and datetimes are converted to local time. If utilizing another timezone, use ⁠attr(date, "tzone") <-⁠ or lubridate::with_tz() to convert back to the desired time zone.

Value

data.frame of the specified SAS table.

See Also

sas_from_r()

Examples


sas_connect()

cars <- sas_to_r("cars", "sashelp")


sasquatch documentation built on Feb. 28, 2026, 1:07 a.m.