9.1 Use {sasr}

{[sasr](https://github.com/insightsengineering/sasr)} is a package built on {[reticulate](https://rstudio.github.io/reticulate/index.html)} so that the Python package {[saspy](https://github.com/sassoftware/saspy)}, an official python interface to connect SAS, can be called from R. It adds some simple wrappers to the {saspy} functionalities to make the syntax similar to R.

Here are some simple examples of how you can use it.

library(sasr)
# Transfer data from R to SAS.
df2sd(mtcars)

# Execute SAS commands.
run_sas("
  data test;
    set work.mtcars;
  run;
")

# Transfer data back to R.
sd2df("test")

This requires that you have a machine with SAS and it accessible through specific connection types, where ssh is a common type of connection.