Closed cqz123 closed 2 years ago
Which version of SASmarkdown, and which version of knitr are you using?
Doug Hemken
Statistical consultant Social Science Computing Cooperative Univ. of Wisc. – Madison
@.**@.> 608-262-4327
From: cqz123 @.> Sent: Monday, September 13, 2021 9:57 PM To: Hemken/SASmarkdown @.> Cc: Subscribed @.***> Subject: [Hemken/SASmarkdown] SASmarkdown fails to use collectcode (#17)
Hi, I've successfully installed the package, but keep getting an error when use collectcode. I've searched online but have not found a solution that works. Here is my code when testing:
`library(SASmarkdown)
saspath <- "D:/SAS 9.4/SASFoundation/9.4/sas.exe" sasopts <- "-nosplash -linesize 75" knitr::opts_chunk$set(engine="sas", engine.path=saspath, engine.opts=sasopts, comment=NA)
knitr::opts_chunk$get()$engine knitr::opts_chunk$get()$engine.path knitr::opts_chunk$get()$engine.opts`
`
data class;
set sashelp.class;
bmi = 703*weight/height**2;
run;
proc means data=class; / not SASHELP.class /
run;
`
Here is resulting error: running: D:/SAS 9.4/SASFoundation/9.4/sas.exe sas49d85ed262a.sas -nosplash -linesize 75 Warning in system2(cmd, code, stdout = TRUE, stderr = TRUE, env = options$engine.env) : running command '"D:/SAS 9.4/SASFoundation/9.4/sas.exe" sas49d85ed262a.sas -nosplash -linesize 75' had status 2 Error in knitrEngine(mergedOptions) :
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/Hemken/SASmarkdown/issues/17, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACYBME4XJNS567KJ5AZBKHDUB22WZANCNFSM5D7EKXAA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You may be using an old version of SASmarkdown, or you may be looking at old documentation for using the package.
In particular, with recent versions of knitr and SASmarkdown (in the last few years), you need to replace
knitr::opts_chunk$set(engine="sas", engine.path=saspath, engine.opts=sasopts, comment=NA)
With
knitr::opts_chunk$set(engine.path=list(sas=saspath, saslog=saspath), engine.opts=list(sas=sasopts, saslog=sasopts), comment=NA)
and your chunk headers should begin
Doug Hemken
Statistical consultant
Social Science Computing Cooperative
Univ. of Wisc. – Madison
***@***.******@***.***>
608-262-4327
From: cqz123 ***@***.***>
Sent: Monday, September 13, 2021 9:57 PM
To: Hemken/SASmarkdown ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [Hemken/SASmarkdown] SASmarkdown fails to use collectcode (#17)
Hi, I've successfully installed the package, but keep getting an error when use collectcode. I've searched online but have not found a solution that works.
Here is my code when testing:
`library(SASmarkdown)
saspath <- "D:/SAS 9.4/SASFoundation/9.4/sas.exe"
sasopts <- "-nosplash -linesize 75"
knitr::opts_chunk$set(engine="sas", engine.path=saspath,
engine.opts=sasopts, comment=NA)
knitr::opts_chunk$get()$engine
knitr::opts_chunk$get()$engine.path
knitr::opts_chunk$get()$engine.opts`
`
data class;
set sashelp.class;
bmi = 703*weight/height**2;
run;
proc means data=class; /* not SASHELP.class */
run;
`
Here is resulting error:
running: D:/SAS 9.4/SASFoundation/9.4/sas.exe sas49d85ed262a.sas -nosplash -linesize 75
Warning in system2(cmd, code, stdout = TRUE, stderr = TRUE, env = options$engine.env) :
running command '"D:/SAS 9.4/SASFoundation/9.4/sas.exe" sas49d85ed262a.sas -nosplash -linesize 75' had status 2
Error in knitrEngine(mergedOptions) :
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<https://github.com/Hemken/SASmarkdown/issues/17>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACYBME4XJNS567KJ5AZBKHDUB22WZANCNFSM5D7EKXAA>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
Hi Doug,
I’m using SASmarkdown 0.4.3. . I updated the knitr to version 1.34 and changed the code as:
library(SASmarkdown) saspath <- "D:/SAS 9.4/SASFoundation/9.4/sas.exe" sasopts <- "-nosplash -linesize 75" knitr::opts_chunk$set(engine.path=list(sas=saspath, saslog=saspath), engine.opts=list(sas=sasopts, saslog=sasopts), comment=NA) knitr::opts_chunk$get()$engine knitr::opts_chunk$get()$engine.path knitr::opts_chunk$get()$engine.opts
Then I tested the code: `
#```{sas}
proc means data=sashelp.class;
run;
and
#```{sas DATAstep, collectcode=TRUE}
data class;
set sashelp.class;
bmi = 703*weight/height**2;
run;
` Both of them just kept on running without stopping.
Thanks!
Do you mean it never gave you results?
Try installing the latest version from Github?
remotes::install_github(“hemken/SASmarkdown”)
Hi Doug,
I am also unable to get collectcode = TRUE to work. R version 4.2.0, SASMarkdown version 0.5.3, knitr version 1.39.2, rmarkdown version 2.14. Here is my code:
```{r}
library(SASmarkdown)
saspath <- "C:/Program Files/SAS94/SASFoundation/9.4/sas.exe"
sasopts <- "-nosplash -linesize 75"
sas_enginesetup(sas=saslog)
knitr::opts_chunk$set(engine.path=list(sas=saspath, saslog=saspath),
engine.opts=list(sas=sasopts, saslog=sasopts),
comment=NA)
```{sas, collectcode=TRUE}
data class;
set sashelp.class;
keep age;
run;
proc means data=class;
run;
```{sas, error = TRUE}
proc means data=class;
run;
The file knits and renders with a warning message:
Warning message:
In system2(cmd, code, stdout = TRUE, stderr = TRUE, env = options$engine.env) :
running command '"C:/Program Files/SAS94/SASFoundation/9.4/sas.exe" sas32007ce110b0.sas -nosplash -linesize 75' had status 2
The first proc means executes, but the second causes this error in the output file:
2 proc means data=class;
ERROR: File WORK.CLASS.DATA does not exist.
3 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
ERROR: Errors printed on page 1.
Any help would be appreciated. Thanks!
I cannot reproduce the error.
I see these things in the code you included:
Try adding a saveSAS=TRUE option to the SAS code blocks, and see if the .sas, .log, and .lst files give you any clues.
Doug Hemken
From: LJGamble @.> Sent: Friday, May 20, 2022 12:09 PM To: Hemken/SASmarkdown @.> Cc: Doug Hemken @.>; Comment @.> Subject: Re: [Hemken/SASmarkdown] SASmarkdown fails to use collectcode (#17)
Hi Doug,
I am also unable to get collectcode = TRUE to work. R version 4.2.0, SASMarkdown version 0.5.3, knitr version 1.39.2, rmarkdown version 2.14. Here is my code:
library(SASmarkdown)
saspath <- "C:/Program Files/SAS94/SASFoundation/9.4/sas.exe"
sasopts <- "-nosplash -linesize 75"
sas_enginesetup(sas=saslog)
knitr::opts_chunk$set(engine.path=list(sas=saspath, saslog=saspath),
engine.opts=list(sas=sasopts, saslog=sasopts),
comment=NA)
```{sas, collectcode=TRUE}
data class;
set sashelp.class;
keep age;
run;
proc means data=class;
run;
```{sas, error = TRUE}
proc means data=class;
run;
The file knits and renders with a warning message:
Warning message:
In system2(cmd, code, stdout = TRUE, stderr = TRUE, env = options$engine.env) :
running command '"C:/Program Files/SAS94/SASFoundation/9.4/sas.exe" sas32007ce110b0.sas -nosplash -linesize 75' had status 2
The first proc means executes, but the second causes this error in the output file:
2 proc means data=class;
ERROR: File WORK.CLASS.DATA does not exist.
3 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
ERROR: Errors printed on page 1.
Any help would be appreciated. Thanks!
—
Reply to this email directly, view it on GitHub<https://github.com/Hemken/SASmarkdown/issues/17#issuecomment-1133131594>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACYBME5JWXA6LMMIZEBKO3TVK7BKTANCNFSM5D7EKXAA>.
You are receiving this because you commented.Message ID: ***@***.******@***.***>>
Try this version:
library(SASmarkdown)
saspath <- "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe"
sasopts <- "-nosplash -linesize 75"
sas_enginesetup(sas=saslog)
knitr::opts_chunk$set(engine.path=list(sas=saspath, saslog=saspath),
engine.opts=list(sas=sasopts, saslog=sasopts),
comment=NA)
data class;
set sashelp.class;
keep age;
run;
proc means data=class;
run;
Hi, I've successfully installed the package, but keep getting an error when using collectcode (R version 4.1.0 knitr version 1.33). I've searched online but have not found a solution that works. Here is my code when testing: `
` Then I got error: