saslog_hookset {SASmarkdown} | R Documentation |
A function to clean SAS log files
Description
The main function here is saslog_hookset
, which sets
"hooks" for knitr. It can set
a "source" hook to clean up SAS logs for the saslog
engine,
or set an "output" hook to clean up SAS logs written to
files and read in using R code.
Used once per hook type per session (i.e. document), during set up.
Usage
saslog_hookset(hooktype)
sasloghook(x, options)
Arguments
hooktype |
Declare which type of hook to set, "source" (the default) or "output". |
options |
|
x |
The log text which is to be cleaned up |
Details
The main function is used with either "source" or "output" as
the value of hooktype
.
The end user should not need to use sasloghook
directly.
This is a
workhorse function used to process selected log output. The main use
is when set up within knit_hooks$set(source=sasloghook)
Once this hook is set, the user may then set any chunk options
SASproctime
SASecho
SASnotes
to FALSE to suppress that part of the SAS log.
Value
saslog_hookset
is used for it's side effect of resetting
a knitr hook.
sasloghook
returns SAS log output internally to knitr
.
Author(s)
Doug Hemken
See Also
Examples
# saslog_hookset() # called during loading
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)
}