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

User setting for chunk options: SASecho, SASproctime and SASnotes #26

Open quanzou opened 1 year ago

quanzou commented 1 year ago

Dear Maintainer and Author,

I am a SASMarkdown user for more than 1 year, and recently (under v 0.8.2), I was trying to set the chunk options: SASproctime, SASecho, SASnotes to either FALSE or TRUE in the SAS log under sashtml5 engine without success, the results always show SASecho only without SASproctime and SASnotes, i.e., "SASecho=T, SASproctime=F,SASnotes=F".

Could shed some lights on the following Rmd codes and point out where I make the mistake in using of saslog_hookset()? Thank you,

Settings under sasMarkdown version 0.8.2, R 4.3.1, SAS 9.4 (TS1M4)

```{r setup, include=FALSE} library(knitr) library(SASmarkdown)

sasexe <- "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" sasopts <- "-nosplash -ls 80 -ps 60" knitr::opts_chunk$set( engine.path=list(sashtml5=sasexe), engine.opts=list(sashtml5=sasopts), comment=NA) knit_hooks$set(source=sasloghook) ```

SASecho, SASproctime and SASnotes were not controlled properly under sashtml5.

```{sashtml5 bug, SASecho=F, SASproctime=T,SASnotes=T} ods html5 style=htmlblue; proc corr data=sashelp.class plots=matrix; run; ```

qdread commented 11 months ago

I'm commenting here to say I am also experiencing this issue with both sashtml and sashtml5. I upgraded to the most recent CRAN version, v0.8.4, and the problem persists. I cannot set SASecho = FALSE, the SAS echo cannot be suppressed. I may need to roll back to v0.8.1 to temporarily work around the issue, but it would be excellent if you could look into this. Thanks for your helpful package!

qdread commented 11 months ago

Additional clarification: I still experience the issue after downgrading to v0.8.1. The issue went away after downgrading to v0.8.1

Hemken commented 11 months ago

The chunk options SASecho, SASproctime, and SASnotes are only effective with log output. So you would have to be using the saslog, sashtmllog, or sashtml5log engine.

For example

```{sashtml5log, SASecho=FALSE}
ods html5 style=htmlblue;
proc corr data=sashelp.class plots=matrix;
run;

would put the log output in your document, without the SAS code but including the procedure time and any notes (however, this example does not produce notes).

I'm a unclear what you would like to see and what you would not like to see in your final document.  If you simply want to see the output without the code echo, use the chunk option "echo=FALSE" with any of the SAS engines.  Then your code chunk would look like this:
ods html5 style=htmlblue;
proc corr data=sashelp.class plots=matrix;
run;
qdread commented 11 months ago

Hi Doug, well, it's the darndest thing ... I upgraded back to the CRAN version of SASmarkdown and suddenly everything works again. The echo = TRUE, SASecho = FALSE combination is now working properly. I swear I didn't change anything else!!! Thanks for your help.

Hemken commented 11 months ago

Recently, I've been occasionally having individual SAS chunks fail for no apparent reason. Usually if I rerender the document, they run.

Also, you will find that collectcode does not work properly with knitr 1.45. I should have a fix for that today, and I'll bump to version 0.8.5

Hemken commented 11 months ago

It turns out there is a bug in SAS with respect to the SAS log. When sending output to ODS HTML5, SAS ignores the PAGESIZE option.

As a result of the bug in SAS, the results from SASmarkdown's sashtml5log engine are corrupted. If you want both HTML output and the SAS log in your document, I recommend using the sashtmllog engine.

quanzou commented 9 months ago

Hi Doug, well, it's the darndest thing ... I upgraded back to the CRAN version of SASmarkdown and suddenly everything works again. The echo = TRUE, SASecho = FALSE combination is now working properly. I swear I didn't change anything else!!! Thanks for your help.

Have you cleared all the temp files generated from v0.8.1? I experienced similar thing, after downgrading, and upgrading back, the chunk works because the all temp files left under the same folder makes it "seems" to work. Changing to a brand new folder, you will have the same issue.

I am looking forward to the newer version, Thanks!