Provides support for executing SLC code blocks in Quarto documents. This function is automatically called by knitr when processing SLC code chunks.
Arguments
- options
A list of chunk options from knitr, including:
- code
Character vector containing the SLC code to execute
- input_data
Name(s) of R data.frame(s) to make available in SLC. Can be a single name or comma-separated names (optional)
- output_data
Name(s) for capturing SLC output data into R. Can be a single name or comma-separated names (optional)
- new_session
Whether to start a fresh SLC process for this chunk (default: FALSE). Set to TRUE for an isolated session that does not share state with other chunks.
- show_listing
Whether to include SAS listing (LST) output below the log (default: TRUE)
- output_files
Override: comma-separated paths to embed as figures. Usually not needed — figures are auto-discovered via log parsing and the
&slcr_gpathtemp directory.- fig-cap
Caption(s) for auto-discovered or
output_filesfigures. A single string is applied to all figures; a vector/list assigns one caption per figure.- eval
Whether to evaluate the code (default: TRUE)
- echo
Whether to show the code (default: TRUE)
- include
Whether to include output (default: TRUE)
Value
A knitr engine output object containing the code and results, followed by any figure markdown.
Details
This function handles the execution of SLC code within Quarto documents by:
Initializing SLC connection if needed (shared by default, or fresh if
new_session = TRUE)Exposing
&slcr_gpath— a per-chunk temp directory — as a SAS macro variable, so user code can write figures to a known locationExecuting the SLC code
Capturing output, log, and listing
Auto-discovering figures via two complementary mechanisms: (1) parsing
NOTE: Successfully written image <path>from the SAS log, (2) scanning&slcr_gpathfor new image filesTransferring output data from SLC to R if specified
ODS GRAPHICS figure capture
Two auto-discovery mechanisms work together — no output_files needed in most cases:
Log parsing: after each chunk the engine scans the SAS log for
NOTE: Successfully written image ...lines. This captures figures regardless of where ODS writes them.slcr_gpath scan: figures written to
&slcr_gpath(a per-chunk temp directory) are also collected. Use withods html gpath="&slcr_gpath"for explicit placement.