Hemken / SASmarkdown

A collection of R functions that extends knitr's capability for using SAS as a language engine
Other
21 stars 5 forks source link

Can't get saspdf engine to run in R Markdown #27

Closed tjfarrar closed 1 year ago

tjfarrar commented 1 year ago

I am trying to follow these instructions to generate SAS LaTeX output in R Markdown. The instructions do not indicate that any special chunk options are required when using the saspdf engine, so I used the chunk options suggested here. However, when I compile the .Rmd file to a PDF, I get the following error message:

Error in `engine()`:
! object 'out.log' not found

Below is my minimal working example of an R Markdown file. The data file abc.csv consists of just a column of letters a to e and a column of numbers 1 to 5. The compile is successful (with verbatim output) if the engine is set to sas in the chunk, but if I change it to saspdf to generate LaTeX output, the above error is thrown.

---
title: "SAS Markdown"
output: pdf_document
---
library(knitr)
library(SASmarkdown)

saspath <- find_sas()
sasopts <- "-nosplash -ls 75" # '-nosplash' fails in Unix terminals
opts_chunk$set(engine.path=list(sas=saspath, saslog=saspath),
               engine.opts=list(sas=sasopts, saslog=sasopts),
                      comment=NA,
                      echo=TRUE, collectcode = TRUE)

SAS Markdown

proc import datafile="abc.csv" dbms=csv
 out=abc;
run;

proc contents data=abc;
run;
Hemken commented 1 year ago

You may have needed

opts_chunk$set(engine.path=list(saspdf=saspath, saspdflog=saspath),

           engine.opts=list(sas=saspdfopts, saspdflog=sasopts),

                  comment=NA,
                  echo=TRUE, collectcode = TRUE)

You actually could get away without setting the engine.path or engine.opts, since those are the defaults.

From: Thomas Joel Farrar @.> Sent: Tuesday, September 12, 2023 10:37 AM To: Hemken/SASmarkdown @.> Cc: Subscribed @.***> Subject: [Hemken/SASmarkdown] Can't get saspdf engine to run in R Markdown (Issue #27)

I am trying to follow these instructionshttps://users.ssc.wisc.edu/~hemken/SASworkshops/Markdown/ch7.html to generate SAS LaTeX output in R Markdown. The instructions do not indicate that any special chunk options are required when using the saspdf engine, so I used the chunk options suggested herehttps://users.ssc.wisc.edu/~hemken/SASworkshops/Markdown/index.html#use-an-engine. However, when I compile the .Rmd file to a PDF, I get the following error message:

Error in engine():

! object 'out.log' not found

Below is my minimal working example of an R Markdown file. The data file abc.csvhttps://github.com/Hemken/SASmarkdown/files/12588254/abc.csv consists of just a column of letters a to e and a column of numbers 1 to 5. The compile is successful (with verbatim output) if the engine is set to sas in the chunk, but if I change it to saspdf to generate LaTeX output, the above error is thrown.


title: "SAS Markdown"

output: pdf_document


library(knitr)

library(SASmarkdown)

saspath <- find_sas()

sasopts <- "-nosplash -ls 75" # '-nosplash' fails in Unix terminals

opts_chunk$set(engine.path=list(sas=saspath, saslog=saspath),

           engine.opts=list(sas=sasopts, saslog=sasopts),

                  comment=NA,

                  echo=TRUE, collectcode = TRUE)

SAS Markdown

proc import datafile="abc.csv" dbms=csv

out=abc;

run;

proc contents data=abc;

run;

— Reply to this email directly, view it on GitHubhttps://github.com/Hemken/SASmarkdown/issues/27, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACYBMEZ2EU7YX3MQTULI7J3X2B6SNANCNFSM6AAAAAA4VBMBVE. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Hemken commented 1 year ago

Fixing the engine.path problem unearthed a problem with collectcode and saspdf.

This has now been fixed in SASmarkdown 0.8.3. I’ve uploaded that here (GitHub), and will work on sending that to CRAN as well.

From: Thomas Joel Farrar @.> Sent: Tuesday, September 12, 2023 10:37 AM To: Hemken/SASmarkdown @.> Cc: Subscribed @.***> Subject: [Hemken/SASmarkdown] Can't get saspdf engine to run in R Markdown (Issue #27)

I am trying to follow these instructionshttps://users.ssc.wisc.edu/~hemken/SASworkshops/Markdown/ch7.html to generate SAS LaTeX output in R Markdown. The instructions do not indicate that any special chunk options are required when using the saspdf engine, so I used the chunk options suggested herehttps://users.ssc.wisc.edu/~hemken/SASworkshops/Markdown/index.html#use-an-engine. However, when I compile the .Rmd file to a PDF, I get the following error message:

Error in engine():

! object 'out.log' not found

Below is my minimal working example of an R Markdown file. The data file abc.csvhttps://github.com/Hemken/SASmarkdown/files/12588254/abc.csv consists of just a column of letters a to e and a column of numbers 1 to 5. The compile is successful (with verbatim output) if the engine is set to sas in the chunk, but if I change it to saspdf to generate LaTeX output, the above error is thrown.


title: "SAS Markdown"

output: pdf_document


library(knitr)

library(SASmarkdown)

saspath <- find_sas()

sasopts <- "-nosplash -ls 75" # '-nosplash' fails in Unix terminals

opts_chunk$set(engine.path=list(sas=saspath, saslog=saspath),

           engine.opts=list(sas=sasopts, saslog=sasopts),

                  comment=NA,

                  echo=TRUE, collectcode = TRUE)

SAS Markdown

proc import datafile="abc.csv" dbms=csv

out=abc;

run;

proc contents data=abc;

run;

— Reply to this email directly, view it on GitHubhttps://github.com/Hemken/SASmarkdown/issues/27, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACYBMEZ2EU7YX3MQTULI7J3X2B6SNANCNFSM6AAAAAA4VBMBVE. You are receiving this because you are subscribed to this thread.Message ID: @.***>