-
Notifications
You must be signed in to change notification settings - Fork 89
Description
I was nerd sniped by your question @statasaurus on the SAS blocks not evaluating the same as previously, so investigated a bit.
I believe the change that has caused this is in the latest release of knitr, specifically yihui/knitr#2225 in https://github.com/yihui/knitr/releases/tag/v1.51 which updates so that all engines have to use their correct comment characters for quarto options, where previously R style options (i.e. #| eval: false) would work as a fallback. This, combined with the fact that SAS is a valid knitr engine (even without {sasquatch} it tries to run SAS from the command line), means we need need to change our style of including SAS code.
To fix this more permanently, we can use a couple of options. Firstly we can correctly include SAS comment style execution options, from testing on my system the following will work (note the star at the start and semicolon at the end of the option):
```{sas}
*| eval: false;
DATA BHR;
SET BMLE;
Bound_UA_HR=exp(-Bound_UA);
Bound_UB_HR=exp(-Bound_UB);
LABEL BOUND_UA_HR="Upper Alpha (HR)" BOUND_UA_HR="Upper Beta (HR)";
PROC PRINT LABEL;
VAR _Stage_ _InfoProp_ Bound_UA Bound_UB Bound_UA_HR Bound_UB_HR;
RUN;
```
Alternatively (and my preferred option) as no SAS executable is installed in Github Actions and we haven't (and likely won't?) setup with a SAS engine using e.g. onDemand for Academics,
we can just set the SAS code blocks to render as markdown by removing the braces {}
```sas
PROC SEQDESIGN BOUNDARYSCALE=MLE ERRSPEND;
DESIGN NSTAGES=2
INFO=CUM(0.748936170212766 1.0)
ALT=UPPER
ALPHA=0.0125
BETA=0.05
METHOD(ALPHA)=ERRFUNCOBF
METHOD(BETA)=ERRFUNCGAMMA(GAMMA=-10)
STOP=BOTH(BETABOUNDARY=NONBINDING);
SAMPLESIZE MODEL=TWOSAMPLESURVIVAL(
NULLMEDSURVTIME=9.4
HAZARDRATIO=0.6
ACCTIME=24
FOLTIME=10
LOSS=EXP(HAZARD=0.018595295942851)
WEIGHT=1);
ODS OUTPUT Boundary=BMLE SampleSize=SS SampleSizeSummary=SSS;
RUN;
```
Both of these work in my tests, and mean that we can remove the global yaml options setting execute: eval: false for all code, and then turning it back on for nearly all code blocks which is an awkward workflow.
I also recommend that we remove {sasquatch} from renv as a dependency, as the only file using it is rounding.qmd which doesn't actually execute any of the {sasquatch} code.
Let me know if these changes make sense, and I can make a PR updating the SAS/R code blocks to reflect it (I think most of the changes can be find/replace, and I can render the site locally so will be able to check it all works). I'll also update the templates to make it clear that that's how SAS code should be included in a comparison doc.