Skip to content

ryanzomorrodi/sasquatch

Repository files navigation

sasquatch

R-CMD-check Codecov test coverage

Use SAS, R, and Quarto Together

sasquatch allows you to combine the power of R, SAS, and quarto together to create reproducible multilingual reports. sasquatch can run SAS code blocks interactively, send data back and forth between SAS and R, and render SAS HTML output within quarto documents.

sasquatch relies on the SASPy Python package. But if you…

  • Don’t have SASPy already installed, or
  • Don’t have a SAS License

Check out vignette("setting_up") for guidance on how to get started with a free SAS On Demand for Academics license (you don’t need to be an academic!).

Installation

You can install the development version of sasquatch like so:

# install.packages("pak")
pak::pkg_install("ryanzomorrodi/sasquatch")

Usage

Once you have setup SASPy and connected to the right python environment using reticulate (if necessary), you can create a quarto document like any other, call sas_connect(), and just get going!

---
format: html
engine: knitr
---

```{r}
library(sasquatch)
sas_connect()
```

```{sas}

```

Code blocks

Now, you should be able to run SAS code blocks in RStudio like any other.

Sending output to viewer

If you want to send the SAS output to the viewer, you can utilize the sas_run_selected() addin with a custom shortcut.

Converting tables

Pass tables between R and SAS with r_to_sas() and sas_to_r().

r_to_sas(mtcars, "mtcars")
cars <- sas_to_r("cars", libref = "sashelp")

Rendering quarto documents

And of course, render beautiful quarto documents in the same style you would expect from SAS with the sas_engine().

Similar packages

saquatch works similarly to packages like sasr or configSAS. In fact, configSAS author Johann Laurent’s talk at a useR! event inspired sasquatch’s creation. sasr, while similar to sasquatch, does not include interactive SAS functionality or a knitr engine. On the other hand, configSAS includes a knitr engine, but no interactive SAS functionality. configSAS knitr output also does not include syntax highlighting and nested SAS output interferes with the styles of the rest of the document.

About

Use SAS, R, and Quarto together

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks