sas_enginesetup {SASmarkdown}R Documentation

Create SAS engines for knitr

Description

In addition to knitr's built in SAS engine, this function creates additional engines for SAS. Once created, these engines may be invoked like any other knitr engine to generate different forms of SAS output.

Set up once per session (i.e. document). Ordinarily this is run automatically when SASmarkdown is loaded.

Usage

sas_enginesetup(...)

saslog(options)
sashtml(options)
saspdf(options)

Arguments

...

arguments to be passed to knit_engines$set(...). These take the form enginename=enginefunction

options

options are passed knitr to the engine functions when they are actually invoked within knitr.

Details

This is a convenience function that uses knit_engines$set() to define knitr language engines.

sas_enginesetup(...) passes it's arguments to knit_engines$set() in the form of enginename=enginefunction pairs. Three pre-defined engine functions are in this package: sashtml, saslog, and saspdf. These functions are used as follows.

The end user should not need to use the language engine functions directly. These are the workhorse functions that actually call SAS and return output. Their main use is when set up within sas_enginesetup(sashtml=sashtml)

Value

There are no return values for sas_enginesetup, engine creation is a side effect here.

The individual language engine functions return SAS code and SAS output internally to knitr.

Author(s)

Doug Hemken

See Also

knit_engines

Examples

sas_enginesetup(sashtml=sashtml, saslog=saslog)

indoc <- '
---
title: "Basic SASmarkdown Doc"
author: "Doug Hemken"
output: html_document
---
# In a first code chunk, set up with
```{r}
library(SASmarkdown)
```
# Then set up SAS code chunks with
```{sas}
proc means data=sashelp.class;
run;
```
'
if (!is.null(SASmarkdown::find_sas())) {
  # To run this example, remove tempdir().
  fmd <- file.path(tempdir(), "test.md")
  fhtml <- file.path(tempdir(), "test.html")

  knitr::knit(text=indoc, output=fmd)
  rmarkdown::render(fmd, "html_document", fhtml)
}


[Package SASmarkdown version 0.8.2 Index]