Closed scarlett closed 1 year ago
I get this as well. I have four separate SAS code chunks. The first two run fine, but the last two throw this error. Setting error=TRUE in each chunk is a work around and the code will render, substituting the log for the code in the html, but it is a pain. Other than the log in the resulting html, everything else (Proc Glimmix and Proc Sgplot) runs and displays fine from RStudio. I've tried grabbing the corresponding generated SAS files and running them in batch mode. They have no errors and run as expected.
Scarlet, what version of R and what version of the rmarkdown package are you using?
Pdiff, can you send me the source and final document?
From: pdiff @.> Sent: Friday, October 21, 2022 5:53:20 PM To: Hemken/SASmarkdown @.> Cc: Subscribed @.***> Subject: Re: [Hemken/SASmarkdown] "error in system2" (Issue #22)
I get this as well. I have four separate SAS code chunks. The first two run fine, but the last two throw this error. Setting error=TRUE in each chunk is a work around and the code will render, substituting the log for the code in the html, but it is a pain. Other than the log in the resulting html, everything else (Proc Glimmix and Proc Sgplot) runs and displays fine from RStudio. I've tried grabbing the corresponding generated SAS files and running them in batch mode. They have no errors and run as expected.
— Reply to this email directly, view it on GitHubhttps://github.com/Hemken/SASmarkdown/issues/22#issuecomment-1287511278, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACYBMEYTAZJF6MD7LOOMMVDWEMNGBANCNFSM6AAAAAARLNCLUY. You are receiving this because you are subscribed to this thread.Message ID: @.***>
Will do, but not until Monday. I don’t have access here at home.
Get Outlook for iOShttps://aka.ms/o0ukef
From: Doug Hemken @.> Sent: Friday, October 21, 2022 4:22:49 PM To: Hemken/SASmarkdown @.> Cc: Price, William @.) @.>; Comment @.***> Subject: Re: [Hemken/SASmarkdown] "error in system2" (Issue #22)
Scarlet, what version of R and what version of the rmarkdown package are you using?
Pdiff, can you send me the source and final document?
From: pdiff @.> Sent: Friday, October 21, 2022 5:53:20 PM To: Hemken/SASmarkdown @.> Cc: Subscribed @.***> Subject: Re: [Hemken/SASmarkdown] "error in system2" (Issue #22)
I get this as well. I have four separate SAS code chunks. The first two run fine, but the last two throw this error. Setting error=TRUE in each chunk is a work around and the code will render, substituting the log for the code in the html, but it is a pain. Other than the log in the resulting html, everything else (Proc Glimmix and Proc Sgplot) runs and displays fine from RStudio. I've tried grabbing the corresponding generated SAS files and running them in batch mode. They have no errors and run as expected.
— Reply to this email directly, view it on GitHubhttps://github.com/Hemken/SASmarkdown/issues/22#issuecomment-1287511278https://urldefense.com/v3/__https://github.com/Hemken/SASmarkdown/issues/22*issuecomment-1287511278*3E__;IyU!!JYXjzlvb!krROM9vODaofAsO3RYWneWbZkVNzAp_VaSJuJmk5jezclcLb2UWncTEBbXMremgDZAwx7erEZ9sAEzYnkFYalaKZ$, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACYBMEYTAZJF6MD7LOOMMVDWEMNGBANCNFSM6AAAAAARLNCLUYhttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ACYBMEYTAZJF6MD7LOOMMVDWEMNGBANCNFSM6AAAAAARLNCLUY*3E__;JQ!!JYXjzlvb!krROM9vODaofAsO3RYWneWbZkVNzAp_VaSJuJmk5jezclcLb2UWncTEBbXMremgDZAwx7erEZ9sAEzYnkKjWZzrd$. You are receiving this because you are subscribed to this thread.Message ID: @.***>
— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/Hemken/SASmarkdown/issues/22*issuecomment-1287529013__;Iw!!JYXjzlvb!krROM9vODaofAsO3RYWneWbZkVNzAp_VaSJuJmk5jezclcLb2UWncTEBbXMremgDZAwx7erEZ9sAEzYnkCRqEfqB$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AMNKVO2MWWFAPKKFHAWGLJ3WEMQUTANCNFSM6AAAAAARLNCLUY__;!!JYXjzlvb!krROM9vODaofAsO3RYWneWbZkVNzAp_VaSJuJmk5jezclcLb2UWncTEBbXMremgDZAwx7erEZ9sAEzYnkN4OO-LB$. You are receiving this because you commented.Message ID: @.***>
Scarlett,
What happens when you run this R code (not in a markdown document)?
cmd <- "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe"
code <- "test.sas" writeLines(c("proc means data=sashelp.class;", "run;"), con=code)
system2(cmd, code, stdout = TRUE, stderr = TRUE) readLines("test.lst")
codeplus <- paste(code, "-nosplash -linesize 75") system2(cmd, codeplus, stdout = TRUE, stderr = TRUE) readLines("test.lst")
-- Doug Hemken Statistical consultant 4226I Social Science Bldg.
@.*** 608-262-4327
To make a consulting appointment send me an email, or use the on-line scheduler: https://doodle.com/mm/doughemken/book-a-time
From: Scarlett Wang @.> Sent: Friday, October 21, 2022 1:31 PM To: Hemken/SASmarkdown @.> Cc: Subscribed @.***> Subject: [Hemken/SASmarkdown] "error in system2" (Issue #22)
Hello,
Thanks so much for building this amazing package. I encountered an issue running the first SAS chunk after installation, the full message is copied below. Looking forward to resolving this issue and exploring the full power of the package! Thanks in advance for your help.
I tried installing SASmarkdown using install.packages("SASmarkdown) and devtools::install_github("Hemken/SASmarkdown"). Both installations seem successful - I saw the correct message "library(SASmarkdown) SAS found at C:/Program Files/SASHome/SASFoundation/9.4/sas.exe SAS engines are now ready to use."
However, when I run the testing code below, it gives me the system2 error.
proc means data=sashelp.class;
run;
"running: C:/Program Files/SASHome/SASFoundation/9.4/sas.exe sas2fe02fcf776f.sas -nosplash -linesize 75 Error in system2(cmd, code, stdout = TRUE, stderr = TRUE, env = options$engine.env) : 'CreateProcess' failed to run 'C:\PROGRA1\SASHome\SASFOU1\9.4\sas.exe sas2fe02fcf776f.sas -nosplash -linesize 75'"
— Reply to this email directly, view it on GitHubhttps://github.com/Hemken/SASmarkdown/issues/22, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACYBME2QL3SJTSACLWCCHKLWELOMVANCNFSM6AAAAAARLNCLUY. You are receiving this because you are subscribed to this thread.Message ID: @.***>
Doug, Attached are the requested files. I’ve also added the text of the Rstudio render window I get, as well as a CSS file I include (ripped from SAS output) to get table formatting I want. Chunks 1-4 run with no issues. Chunks 5 and 6 must be run with the ERROR=TRUE option to render in the final html.
Thank you for looking into this. Let me know if there is more information I can provide.
Bill
BILL PRICE Director
College of Agricultural and Life Sciences Statistical Programs Office: 307, AgSci @.**@.> www.uidaho.edu/cals/statistical-programshttps://www.uidaho.edu/cals/statistical-programs www.agstats.io 208-885-5930
[University of Idaho]
From: Doug Hemken @.> Sent: Friday, October 21, 2022 4:23 PM To: Hemken/SASmarkdown @.> Cc: Price, William @.) @.>; Comment @.***> Subject: Re: [Hemken/SASmarkdown] "error in system2" (Issue #22)
Scarlet, what version of R and what version of the rmarkdown package are you using?
Pdiff, can you send me the source and final document?
From: pdiff @.<mailto:@.>> Sent: Friday, October 21, 2022 5:53:20 PM To: Hemken/SASmarkdown @.<mailto:@.>> Cc: Subscribed @.<mailto:@.>> Subject: Re: [Hemken/SASmarkdown] "error in system2" (Issue #22)
I get this as well. I have four separate SAS code chunks. The first two run fine, but the last two throw this error. Setting error=TRUE in each chunk is a work around and the code will render, substituting the log for the code in the html, but it is a pain. Other than the log in the resulting html, everything else (Proc Glimmix and Proc Sgplot) runs and displays fine from RStudio. I've tried grabbing the corresponding generated SAS files and running them in batch mode. They have no errors and run as expected.
— Reply to this email directly, view it on GitHubhttps://github.com/Hemken/SASmarkdown/issues/22#issuecomment-1287511278https://urldefense.com/v3/__https:/github.com/Hemken/SASmarkdown/issues/22*issuecomment-1287511278*3E__;IyU!!JYXjzlvb!krROM9vODaofAsO3RYWneWbZkVNzAp_VaSJuJmk5jezclcLb2UWncTEBbXMremgDZAwx7erEZ9sAEzYnkFYalaKZ$, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACYBMEYTAZJF6MD7LOOMMVDWEMNGBANCNFSM6AAAAAARLNCLUYhttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ACYBMEYTAZJF6MD7LOOMMVDWEMNGBANCNFSM6AAAAAARLNCLUY*3E__;JQ!!JYXjzlvb!krROM9vODaofAsO3RYWneWbZkVNzAp_VaSJuJmk5jezclcLb2UWncTEBbXMremgDZAwx7erEZ9sAEzYnkKjWZzrd$. You are receiving this because you are subscribed to this thread.Message ID: @.<mailto:@.>>
— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/Hemken/SASmarkdown/issues/22*issuecomment-1287529013__;Iw!!JYXjzlvb!krROM9vODaofAsO3RYWneWbZkVNzAp_VaSJuJmk5jezclcLb2UWncTEBbXMremgDZAwx7erEZ9sAEzYnkCRqEfqB$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AMNKVO2MWWFAPKKFHAWGLJ3WEMQUTANCNFSM6AAAAAARLNCLUY__;!!JYXjzlvb!krROM9vODaofAsO3RYWneWbZkVNzAp_VaSJuJmk5jezclcLb2UWncTEBbXMremgDZAwx7erEZ9sAEzYnkN4OO-LB$. You are receiving this because you commented.Message ID: @.**@.>>
processing file: test.Rmd |..... | 8% ordinary text without R code
|........... | 15% label: setup (with options) List of 1 $ include: logi FALSE
|................ | 23% ordinary text without R code
|...................... | 31% label: unnamed-chunk-1 (with options) List of 1 $ include: logi FALSE
|........................... | 38% ordinary text without R code
|................................ | 46% label: Data1 (with options) List of 7 $ engine : chr "sashtml" $ collectcode: logi TRUE $ engine.path: chr "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" $ include : logi TRUE $ engine.opts: chr "-nosplash -ls 200 " $ comment : chr "" $ error : logi FALSE
running: C:/Program Files/SASHome/SASFoundation/9.4/sas.exe sas25c8a03997.sas -nosplash -ls 200
|...................................... | 54%
ordinary text without R code
|........................................... | 62% label: Freq1 (with options) List of 7 $ engine : chr "sashtml" $ collectcode: logi TRUE $ engine.path: chr "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" $ include : logi TRUE $ engine.opts: chr "-nosplash -ls 200 " $ comment : chr "" $ error : logi FALSE
running: C:/Program Files/SASHome/SASFoundation/9.4/sas.exe sas25c839f03be7.sas -nosplash -ls 200
|................................................ | 69%
ordinary text without R code
|...................................................... | 77% label: Freq2 (with options) List of 7 $ engine : chr "sashtml" $ collectcode: logi TRUE $ engine.path: chr "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" $ include : logi TRUE $ engine.opts: chr "-nosplash -ls 200 " $ comment : chr "" $ error : logi TRUE
running: C:/Program Files/SASHome/SASFoundation/9.4/sas.exe sas25c8522d3d29.sas -nosplash -ls 200
|........................................................... | 85%
ordinary text without R code
|................................................................. | 92% label: Logistic1 (with options) List of 7 $ engine : chr "sashtml" $ collectcode: logi TRUE $ engine.path: chr "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" $ include : logi TRUE $ engine.opts: chr "-nosplash -ls 200 " $ comment : chr "" $ error : logi TRUE
running: C:/Program Files/SASHome/SASFoundation/9.4/sas.exe sas25c87cf63308.sas -nosplash -ls 200
|......................................................................| 100%
ordinary text without R code
knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet) knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet) knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet) knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet) "C:/Program Files/RStudio/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS test.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.html --lua-filter "C:\Users\bprice\AppData\Local\renv\cache\v5\R-4.2\x86_64-w64-mingw32\rmarkdown\2.16\0f3eaa1547e2c6880d4de1c043ac6826\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\Users\bprice\AppData\Local\renv\cache\v5\R-4.2\x86_64-w64-mingw32\rmarkdown\2.16\0f3eaa1547e2c6880d4de1c043ac6826\rmarkdown\rmarkdown\lua\latex-div.lua" --embed-resources --standalone --variable bs3=TRUE --section-divs --table-of-contents --toc-depth 3 --variable toc_float=1 --variable toc_selectors=h1,h2,h3 --variable toc_collapsed=1 --variable toc_smooth_scroll=1 --variable toc_print=1 --template "C:\Users\bprice\AppData\Local\renv\cache\v5\R-4.2\x86_64-w64-mingw32\rmarkdown\2.16\0f3eaa1547e2c6880d4de1c043ac6826\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --number-sections --variable theme=bootstrap --css ".\sas.default.css" --mathjax --variable "mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --include-in-header "C:\Users\bprice\AppData\Local\Temp\RtmpQrMZKC\rmarkdown-str25c87888351d.html" output file: test.knit.md
Output created: test.html Warning messages: 1: In system2(cmd, code, stdout = TRUE, stderr = TRUE, env = options$engine.env) : running command '"C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" sas25c8522d3d29.sas -nosplash -ls 200 ' had status 1 2: In system2(cmd, code, stdout = TRUE, stderr = TRUE, env = options$engine.env) : running command '"C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" sas25c87cf63308.sas -nosplash -ls 200 ' had status 1
Bill, I got the knitr log, but I guess I don’t know how to get attachments through Github. Could you send those files to me directly?
@.***
From: pdiff @.> Sent: Monday, October 24, 2022 12:12 PM To: Hemken/SASmarkdown @.> Cc: Doug Hemken @.>; Comment @.> Subject: Re: [Hemken/SASmarkdown] "error in system2" (Issue #22)
Doug, Attached are the requested files. I’ve also added the text of the Rstudio render window I get, as well as a CSS file I include (ripped from SAS output) to get table formatting I want. Chunks 1-4 run with no issues. Chunks 5 and 6 must be run with the ERROR=TRUE option to render in the final html.
Thank you for looking into this. Let me know if there is more information I can provide.
Bill
BILL PRICE Director
College of Agricultural and Life Sciences Statistical Programs Office: 307, AgSci @.**@.> www.uidaho.edu/cals/statistical-programshttps://www.uidaho.edu/cals/statistical-programs www.agstats.io 208-885-5930
[University of Idaho]
processing file: test.Rmd |..... | 8% ordinary text without R code
|........... | 15% label: setup (with options) List of 1 $ include: logi FALSE
|................ | 23% ordinary text without R code
|...................... | 31% label: unnamed-chunk-1 (with options) List of 1 $ include: logi FALSE
|........................... | 38% ordinary text without R code
|................................ | 46% label: Data1 (with options) List of 7 $ engine : chr "sashtml" $ collectcode: logi TRUE $ engine.path: chr "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" $ include : logi TRUE $ engine.opts: chr "-nosplash -ls 200 " $ comment : chr "" $ error : logi FALSE
running: C:/Program Files/SASHome/SASFoundation/9.4/sas.exe sas25c8a03997.sas -nosplash -ls 200 |...................................... | 54% ordinary text without R code
|........................................... | 62% label: Freq1 (with options) List of 7 $ engine : chr "sashtml" $ collectcode: logi TRUE $ engine.path: chr "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" $ include : logi TRUE $ engine.opts: chr "-nosplash -ls 200 " $ comment : chr "" $ error : logi FALSE
running: C:/Program Files/SASHome/SASFoundation/9.4/sas.exe sas25c839f03be7.sas -nosplash -ls 200 |................................................ | 69% ordinary text without R code
|...................................................... | 77% label: Freq2 (with options) List of 7 $ engine : chr "sashtml" $ collectcode: logi TRUE $ engine.path: chr "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" $ include : logi TRUE $ engine.opts: chr "-nosplash -ls 200 " $ comment : chr "" $ error : logi TRUE
running: C:/Program Files/SASHome/SASFoundation/9.4/sas.exe sas25c8522d3d29.sas -nosplash -ls 200 |........................................................... | 85% ordinary text without R code
|................................................................. | 92% label: Logistic1 (with options) List of 7 $ engine : chr "sashtml" $ collectcode: logi TRUE $ engine.path: chr "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" $ include : logi TRUE $ engine.opts: chr "-nosplash -ls 200 " $ comment : chr "" $ error : logi TRUE
running: C:/Program Files/SASHome/SASFoundation/9.4/sas.exe sas25c87cf63308.sas -nosplash -ls 200 |......................................................................| 100% ordinary text without R code
knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet) knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet) knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet) knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet) "C:/Program Files/RStudio/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS test.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.html --lua-filter "C:\Users\bprice\AppData\Local\renv\cache\v5\R-4.2\x86_64-w64-mingw32\rmarkdown\2.16\0f3eaa1547e2c6880d4de1c043ac6826\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\Users\bprice\AppData\Local\renv\cache\v5\R-4.2\x86_64-w64-mingw32\rmarkdown\2.16\0f3eaa1547e2c6880d4de1c043ac6826\rmarkdown\rmarkdown\lua\latex-div.lua" --embed-resources --standalone --variable bs3=TRUE --section-divs --table-of-contents --toc-depth 3 --variable toc_float=1 --variable toc_selectors=h1,h2,h3 --variable toc_collapsed=1 --variable toc_smooth_scroll=1 --variable toc_print=1 --template "C:\Users\bprice\AppData\Local\renv\cache\v5\R-4.2\x86_64-w64-mingw32\rmarkdown\2.16\0f3eaa1547e2c6880d4de1c043ac6826\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --number-sections --variable theme=bootstrap --css ".\sas.default.css" --mathjax --variable "mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --include-in-header "C:\Users\bprice\AppData\Local\Temp\RtmpQrMZKC\rmarkdown-str25c87888351d.html" output file: test.knit.md
Output created: test.html Warning messages: 1: In system2(cmd, code, stdout = TRUE, stderr = TRUE, env = options$engine.env) : running command '"C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" sas25c8522d3d29.sas -nosplash -ls 200 ' had status 1 2: In system2(cmd, code, stdout = TRUE, stderr = TRUE, env = options$engine.env) : running command '"C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" sas25c87cf63308.sas -nosplash -ls 200 ' had status 1
Sorry. I used my email to reply, not Github. Github won't let me drop these file types here, but here is a dropbox link
Got them
From: pdiff @.> Sent: Monday, October 24, 2022 12:50 PM To: Hemken/SASmarkdown @.> Cc: Doug Hemken @.>; Comment @.> Subject: Re: [Hemken/SASmarkdown] "error in system2" (Issue #22)
Sorry. I used my email to reply, not Github. Github won't let me drop these file types here, but here is a dropbox linkhttps://www.dropbox.com/sh/900upmg22m4q8ut/AABCdcWWXGNFSnUKO7RvfC8va?dl=0
— Reply to this email directly, view it on GitHubhttps://github.com/Hemken/SASmarkdown/issues/22#issuecomment-1289381466, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACYBME7BM6RR4QMGLVKLTQ3WE3D5XANCNFSM6AAAAAARLNCLUY. You are receiving this because you commented.Message ID: @.***>
Thanks for including the data!
I notice you are using an older style of specifying chunk options. A quick fix seems to be working with the "new" style (actually, this is a couple of years old by now).
So instead of
```{r include=FALSE}
require(SASmarkdown)
saspath <- "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe"
sasopts <- "-nosplash -ls 200 "
I would set up with
require(SASmarkdown)
sasopts <- "-nosplash -ls 200 "
knitr::opts_chunk$set(engine.opts=list(sashtml=sasopts, sashtmllog=sasopts),
comment=NA)
and in later chunks, instead of
* whatever;
I would use
* whatever;
You also don't need to accumulate all that code with collectcode=TRUE. You only need that for your DATA step.
[testdh.Rmd.txt](https://github.com/Hemken/SASmarkdown/files/9854291/testdh.Rmd.txt)
Hi Hemken,
Thanks so much for your prompt reply! I use 4.2.1 base R, 2.17 rmarkdown, and 1.40 knitr
I ran the codes you suggested in a script and got similar error messages [image: image.png]
Scarlett, I do not see an image. Could you upload your screenshot to Github, or better, copy and paste the text?
Can you send me your source document? To upload it to Github, you will have to save it with a “.txt” file extension instead of “.rmd”.
From: Scarlett Wang @.> Sent: Monday, October 24, 2022 1:51 PM To: Hemken/SASmarkdown @.> Cc: Doug Hemken @.>; Comment @.> Subject: Re: [Hemken/SASmarkdown] "error in system2" (Issue #22)
Hi Hemken,
Thanks so much for your prompt reply! I use 4.2.1 base R, 2.17 rmarkdown, and 1.40 knitr
I ran the codes you suggested in a script and got similar error messages [image: image.png]
Sure! Attached is the source document, and the testing code/error copied below.
cmd <- "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" code <- "test.sas" writeLines(c("proc means data=sashelp.class;", "run;"), con=code) system2(cmd, code, stdout = TRUE, stderr = TRUE) Error in system2(cmd, code, stdout = TRUE, stderr = TRUE) : 'CreateProcess' failed to run 'C:\PROGRA~1\SASHome\SASFOU~1\9.4\sas.exe test.sas' readLines("test.lst") Error in file(con, "r") : cannot open the connection In addition: Warning message: In file(con, "r") : cannot open file 'test.lst': No such file or directory codeplus <- paste(code, "-nosplash -linesize 75") system2(cmd, codeplus, stdout = TRUE, stderr = TRUE) Error in system2(cmd, codeplus, stdout = TRUE, stderr = TRUE) : 'CreateProcess' failed to run 'C:\PROGRA~1\SASHome\SASFOU~1\9.4\sas.exe test.sas -nosplash -linesize 75' readLines("test.lst") Error in file(con, "r") : cannot open the connection In addition: Warning message: In file(con, "r") : cannot open file 'test.lst': No such file or dir sas test.txt ectory
Thanks for including the data!
I notice you are using an older style of specifying chunk options. A quick fix seems to be working with the "new" style (actually, this is a couple of years old by now).
So instead of
```{r include=FALSE} require(SASmarkdown) saspath <- "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" sasopts <- "-nosplash -ls 200 "
I would set up with
require(SASmarkdown) sasopts <- "-nosplash -ls 200 " knitr::opts_chunk$set(engine.opts=list(sashtml=sasopts, sashtmllog=sasopts), comment=NA)
and in later chunks, instead of
* whatever;
I would use
* whatever;
You also don't need to accumulate all that code with collectcode=TRUE. You only need that for your DATA step. [testdh.Rmd.txt](https://github.com/Hemken/SASmarkdown/files/9854291/testdh.Rmd.txt)
Perfect. Thank you, and thank you for the package. It has been very helpful. I guess I picked that legacy code up from an old web page and, yes, the collect codes were there as I was trying to debug some things.
Thanks again and for the quick response.
Bill
I’ve actually further narrowed it down to the “collectcode = TRUE” in the second SAS chunk. None of the other changes I made mattered! (but I still recommend them)
From: pdiff @.> Sent: Monday, October 24, 2022 2:15 PM To: Hemken/SASmarkdown @.> Cc: Doug Hemken @.>; Comment @.> Subject: Re: [Hemken/SASmarkdown] "error in system2" (Issue #22)
Perfect. Thank you, and thank you for the package. It has been very helpful. I guess I picked that legacy code up from an old web page and, yes, the collect codes were there as I was trying to debug some things.
Thanks again and for the quick response.
Bill
— Reply to this email directly, view it on GitHubhttps://github.com/Hemken/SASmarkdown/issues/22#issuecomment-1289481137, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACYBME7MWWCM3EROTTG2XTDWE3N23ANCNFSM6AAAAAARLNCLUY. You are receiving this because you commented.Message ID: @.***>
Scarlett, your code runs for me, although with a warning that you try to make “sashtml” the default engine before it has been defined (i.e. before you load the SASmarkdown package).
I do not reproduce your error message.
What version of the Windows operating system are you using? What version of SAS do you have, and where is it actually installed?
From: Scarlett Wang @.> Sent: Monday, October 24, 2022 2:06 PM To: Hemken/SASmarkdown @.> Cc: Doug Hemken @.>; Comment @.> Subject: Re: [Hemken/SASmarkdown] "error in system2" (Issue #22)
Sure! Attached is the source document, and the testing code/error copied below.
cmd <- "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" code <- "test.sas" writeLines(c("proc means data=sashelp.class;", "run;"), con=code) system2(cmd, code, stdout = TRUE, stderr = TRUE) Error in system2(cmd, code, stdout = TRUE, stderr = TRUE) : 'CreateProcess' failed to run 'C:\PROGRA1\SASHome\SASFOU1\9.4\sas.exe test.sas' readLines("test.lst") Error in file(con, "r") : cannot open the connection In addition: Warning message: In file(con, "r") : cannot open file 'test.lst': No such file or directory codeplus <- paste(code, "-nosplash -linesize 75") system2(cmd, codeplus, stdout = TRUE, stderr = TRUE) Error in system2(cmd, codeplus, stdout = TRUE, stderr = TRUE) : 'CreateProcess' failed to run 'C:\PROGRA1\SASHome\SASFOU1\9.4\sas.exe test.sas -nosplash -linesize 75' readLines("test.lst") Error in file(con, "r") : cannot open the connection In addition: Warning message: In file(con, "r") : cannot open file 'test.lst': No such file or dir sas test.txthttps://github.com/Hemken/SASmarkdown/files/9854581/sas.test.txt ectory
— Reply to this email directly, view it on GitHubhttps://github.com/Hemken/SASmarkdown/issues/22#issuecomment-1289471570, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACYBMEZEFT35G6AJLZRJIY3WE3M2RANCNFSM6AAAAAARLNCLUY. You are receiving this because you commented.Message ID: @.***>
knitr::opts_chunk$get()$engine
knitr::opts_chunk$get()$engine.path
knitr::opts_chunk$get()$engine.opts
knitr::opts_chunk$get()$engine.env
saspath <- "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe"
sasopts <- "-nosplash -linesize 75"
# knitr::opts_chunk$set(engine="sashtml", engine.path=saspath,
# engine.opts=sasopts, comment=NA)
library(SASmarkdown)
saspath <- "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe"
sasopts <- "-nosplash -ls 75" # '-nosplash' fails in Unix terminals
knitr::opts_chunk$set(engine.path=list(sas=saspath, saslog=saspath),
engine.opts=list(sas=sasopts, saslog=sasopts),
comment=NA)
proc means data=sashelp.class;
run;
proc corr data=sashelp.class plots=matrix;
run;
Revised version of Scarlett's code that works for me:
Ahh that's interesting. I use windows server 2016 standard version 1607. SAS is 9.4 (TS1M7), which is installed C:\Program Files\SASHome. A colleage of mine uses a clone of my VM and could install and use the package.
I’m also on a Windows server, running as a VM, and using SAS 9.4 TS1M7.
From: Scarlett Wang @.> Sent: Monday, October 24, 2022 2:47 PM To: Hemken/SASmarkdown @.> Cc: Doug Hemken @.>; Comment @.> Subject: Re: [Hemken/SASmarkdown] "error in system2" (Issue #22)
Ahh that's interesting. I use windows server 2016 standard version 1607. SAS is 9.4 (TS1M7), which is installed C:\Program Files\SASHome. A colleage of mine uses a clone of my VM and could install and use the package.
I'm using the newest version of RStudio. Could that be the problem?
RStudio 2022.07.1+554 "Spotted Wakerobin" Release (7872775ebddc40635780ca1ed238934c3345c5de, 2022-07-22) for Windows Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36
On Mon, Oct 24, 2022 at 4:05 PM Doug Hemken @.***> wrote:
I’m also on a Windows server, running as a VM, and using SAS 9.4 TS1M7.
Seems unlikely that is the problem, but I'll give it a try. The message suggests the SAS executable is not where we think it should be.
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Scarlett Wang @.> Sent: Monday, October 24, 2022 3:14:53 PM To: Hemken/SASmarkdown @.> Cc: Doug Hemken @.>; Comment @.> Subject: Re: [Hemken/SASmarkdown] "error in system2" (Issue #22)
I'm using the newest version of RStudio. Could that be the problem?
RStudio 2022.07.1+554 "Spotted Wakerobin" Release (7872775ebddc40635780ca1ed238934c3345c5de, 2022-07-22) for Windows Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36
More on Bill's "error in system2":
The collectcode
captured a call to ODS graphics, the plots
option in a PROC FREQ
. This requires an explicit ODS GRAPHICS ON;
when included in a collectcode
(or when using the plain sas
knitr engine).
I find it curious that PROC SGPLOT
does not produce the same error when collected - I thought this too was ods graphics.
Scarlett,
That is the same version of RStudio I have been using.
Can you please verify the location of the SAS executable? Launch SAS, then run
%put %sysget(SASROOT);
More on Bill's "error in system2":
The
collectcode
captured a call to ODS graphics, theplots
option in aPROC FREQ
. This requires an explicitODS GRAPHICS ON;
when included in acollectcode
(or when using the plainsas
knitr engine).I find it curious that
PROC SGPLOT
does not produce the same error when collected - I thought this too was ods graphics.
Hmmm, I had thought of this too (thought I had tried the ODS Graphics On command), but dismissed it when the sgplot did not have similar issues. Glad you narrowed this down.
I'll never understand why SAS didn't just implement markdown features as part of ODS anyway. It's 90% there.
Scarlett, did you try anything else?
-- Doug Hemken SSCC statistical consultant 4226i Social Science Bldg.
Thanks for following up, Doug! I got in touch with SAS support since it looks like it could be an installation issue. We also have other symptoms - double clicking .sas file doesn't work Will try SASmarkdown again after troubleshooting with SAS support.
On Mon, Oct 31, 2022 at 7:22 AM Doug Hemken @.***> wrote:
Scarlett, did you try anything else?
-- Doug Hemken SSCC statistical consultant 4226i Social Science Bldg.
— Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_Hemken_SASmarkdown_issues_22-23issuecomment-2D1296945634&d=DwMCaQ&c=slrrB7dE8n7gBJbeO0g-IQ&r=ue2aBicUEZa7HSetEYMqduinB4D3Jl6YXsiQy7L7O7I&m=ShpyT3m3UgDKqGQAfpTm85LINIeq-FuWQW1HMHVnzJxXh8EgI6-DvY1Xus2HAPjf&s=V0PBk1JiGyeksC41iU7SZEXOWjrF6Cjw4gnrnvaFTcM&e=, or unsubscribe https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AIYCZXCZGCQCP2IA2YYEEVDWF6TVPANCNFSM6AAAAAARLNCLUY&d=DwMCaQ&c=slrrB7dE8n7gBJbeO0g-IQ&r=ue2aBicUEZa7HSetEYMqduinB4D3Jl6YXsiQy7L7O7I&m=ShpyT3m3UgDKqGQAfpTm85LINIeq-FuWQW1HMHVnzJxXh8EgI6-DvY1Xus2HAPjf&s=GPfNBrU8dmObWVmW0GAZmVtslaiORwKyE8uPbtu7ytE&e= . You are receiving this because you authored the thread.Message ID: @.***>
No follow up from Scarlett.
Hello,
Thanks so much for building this amazing package. I encountered an issue running the first SAS chunk after installation, the full message is copied below. Looking forward to resolving this issue and exploring the full power of the package! Thanks in advance for your help.
I tried installing SASmarkdown using install.packages("SASmarkdown) and devtools::install_github("Hemken/SASmarkdown"). Both installations seem successful - I saw the correct message "library(SASmarkdown) SAS found at C:/Program Files/SASHome/SASFoundation/9.4/sas.exe SAS engines are now ready to use."
However, when I run the testing code below, it gives me the system2 error.
"running: C:/Program Files/SASHome/SASFoundation/9.4/sas.exe sas2fe02fcf776f.sas -nosplash -linesize 75 Error in system2(cmd, code, stdout = TRUE, stderr = TRUE, env = options$engine.env) : 'CreateProcess' failed to run 'C:\PROGRA~1\SASHome\SASFOU~1\9.4\sas.exe sas2fe02fcf776f.sas -nosplash -linesize 75'"