| Title: | 'SAS' Interface |
|---|---|
| Description: | Provides a 'SAS' interface, through 'SASPy'(<https://sassoftware.github.io/saspy/>) and 'reticulate'(<https://rstudio.github.io/reticulate/>). This package helps you create 'SAS' sessions, execute 'SAS' code in remote 'SAS' servers, retrieve execution results and log, and exchange datasets between 'SAS' and 'R'. It also helps you to install 'SASPy' and create a configuration file for the connection. Please review the 'SASPy' license file as instructed so that you comply with its separate and independent license. |
| Authors: | Liming Li [aut, cre], Daniel Sabanes Bove [aut], Isaac Gravestock [aut], F. Hoffmann-La Roche AG [cph, fnd] |
| Maintainer: | Liming Li <[email protected]> |
| License: | Apache License 2.0 |
| Version: | 0.1.4 |
| Built: | 2026-05-20 10:31:33 UTC |
| Source: | https://github.com/insightsengineering/sasr |
sasr Packagesasr provides interface to SAS through saspy and reticulate in R.
Maintainer: Liming Li [email protected]
Authors:
Daniel Sabanes Bove [email protected]
Isaac Gravestock [email protected]
Other contributors:
F. Hoffmann-La Roche AG [copyright holder, funder]
Useful links:
Report bugs at https://github.com/insightsengineering/sasr/issues
Transfer
data.frame object from R environment to SAS.
df2sd(df, table = "_df", libref = "", ..., sas_session = get_sas_session())df2sd(df, table = "_df", libref = "", ..., sas_session = get_sas_session())
df |
( |
table |
( |
libref |
( |
... |
additional arguments for |
sas_session |
( |
"saspy.sasdata.SASdata" object.
Obtain the file path of the SAS configuration file.
get_sas_cfg()get_sas_cfg()
Obtain the default sas configuration file. By default, it will search
the sascfg_personal.py file under current directory. If it does not exist, it will
search this file under home directory. If this file does not exist, NULL will be returned.
The file path of default SAS configuration file, or NULL if not found.
Obtain the last session or default session.
get_sas_session()get_sas_session()
this function is designed to facilitate the R users programming practice of function oriented programming instead of object oriented programmings.
A new SAS session if there are no previous SAS session, or the last SAS session created.
saspy Module
Install
saspy module in reticulate.
install_saspy(method = "auto", conda = "auto")install_saspy(method = "auto", conda = "auto")
method |
( |
conda |
( |
No return value.
Run SAS code with a SAS session.
run_sas(sas_code, results = c("TEXT", "HTML"), sas_session = get_sas_session())run_sas(sas_code, results = c("TEXT", "HTML"), sas_session = get_sas_session())
sas_code |
( |
results |
( |
sas_session |
( |
run_sas will run sas code through SAS session.
The results is a named list of LST and LOG.
The result part will be stored in LST, and log will be stored in LOG.
If results argument is "TEXT", then results are in text format;
if results argument is "HTML", then results are in html format.
Named list with following elements:
LOG: string of SAS execution log.
LST: string of SAS execution result, in html or txt format.
SAS engine function
sas_engine(options)sas_engine(options)
options |
See knitr documentation on engines. |
sas_session(sascfg = get_sas_cfg(), ...)sas_session(sascfg = get_sas_cfg(), ...)
sascfg |
( |
... |
additional arguments passed to |
SAS session.
sas_session_ssh(sascfg = get_sas_cfg(), ...)sas_session_ssh(sascfg = get_sas_cfg(), ...)
sascfg |
( |
... |
additional arguments passed to |
SAS session.
Create SAS session configuration file based on argument.
sascfg( name = "default", host, saspath, ssh = system("which ssh", intern = TRUE), encoding = "latin1", options = list("-fullstimer"), ..., sascfg = "sascfg_personal.py" )sascfg( name = "default", host, saspath, ssh = system("which ssh", intern = TRUE), encoding = "latin1", options = list("-fullstimer"), ..., sascfg = "sascfg_personal.py" )
name |
( |
host |
( |
saspath |
( |
ssh |
( |
encoding |
( |
options |
( |
... |
additional arguments. |
sascfg |
( |
host and saspath are required to connect to remote SAS server. Other arguments can follow default.
If transferring datasets is needed and the client(running sasr) is not reachable from the server,
then tunnelling is required.
Use tunnel = , rtunnel = to specify tunnels and reverse tunnels.
The values should be length 1 integer.
No return value.
Transfer the table in SAS session to R.
sd2df(table, libref = "", ..., sas_session = get_sas_session())sd2df(table, libref = "", ..., sas_session = get_sas_session())
table |
( |
libref |
( |
... |
additional arguments for |
sas_session |
( |
data.frame object.