-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
110 lines (78 loc) · 3.15 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# sasquatch
<!-- badges: start -->
[![R-CMD-check](https://github.com/ryanzomorrodi/sasr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ryanzomorrodi/sasr/actions/workflows/R-CMD-check.yaml)
[![Codecov test
coverage](https://codecov.io/gh/ryanzomorrodi/sasquatch/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ryanzomorrodi/sasquatch?branch=main)
<!-- badges: end -->
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`](https://sassoftware.github.io/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](https://www.sas.com/en_us/software/on-demand-for-academics)
license (you don't need to be an academic!).
## Installation
You can install the development version of sasquatch like so:
```{r eval = FALSE}
# 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!
`````{verbatim}
---
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.
![](man/figures/run_sas_chunk.gif)
#### 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.
![](man/figures/run_sas_selected.gif)
#### Converting tables
Pass tables between R and SAS with `r_to_sas()` and `sas_to_r()`.
```{r, eval = FALSE}
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()`.
![](man/figures/rendered_quarto.png)
## Similar packages
`saquatch` works similarly to packages like [`sasr`](https://sassoftware.github.io/saspy/)
or [`configSAS`](https://github.com/baselr/configSAS). In fact, `configSAS`
author [Johann Laurent's talk](https://www.youtube.com/watch?v=4c9T6-__vI8) 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.