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

`find_sas()` only search the default path on windows #18

Closed fenguoerbian closed 2 years ago

fenguoerbian commented 2 years ago

The find_sas() function only search for the default installation path of SAS on windows platform, which means this will not work for SAS installed at custom path. But actually one can use Sys.which("sas") to determine whether sas.exe is in the PATH, just like that in the Linux branch of find_sas().

So I'm curious if this is by design? My SAS is installed in a custom path in D drive and when loading the package

https://github.com/Hemken/SASmarkdown/blob/54d6140b4a343ea966995802916a58781824d6e0/R/misc.r#L22

reports NULL, which results to following setting of engine.path is not excecuted and leads to the out.log not found issue I'v encountered

Hemken commented 2 years ago

If the SAS executable is found on your PATH, you can include as an initial code block

https://www.ssc.wisc.edu/~hemken/SASworkshops/Markdown/SASmdpackage.html#use-an-engine

library(SASmarkdown)
saspath <- "sas.exe"
sasopts <- "-nosplash -ls 75"
knitr::opts_chunk$set(engine.path=list(sas=saspath, saslog=saspath),
                      engine.opts=list(sas=sasopts, saslog=sasopts),
                      comment=NA)

From: Chao Cheng @.> Sent: Thursday, July 7, 2022 8:14 AM To: Hemken/SASmarkdown @.> Cc: Subscribed @.***> Subject: [Hemken/SASmarkdown] find_sas() only search the default path on windows (Issue #18)

The find_sas()<R/find_sas.r> function only search for the default installation path of SAS on windows platform, which means this will not work for SAS installed at custom path. But actually one can use Sys.which("sas") to determine whether sas.exe is in the PATH, just like that in the Linux branch of find_sas()<R/find_sas.r>.

So I'm curious if this is by design? My SAS is installed in a custom path in D drive and when loading the package

https://github.com/Hemken/SASmarkdown/blob/54d6140b4a343ea966995802916a58781824d6e0/R/misc.r#L22

reports NULL, which results to following setting of engine.path is not excecuted and leads to the out.log not found issuehttps://github.com/Hemken/SASmarkdown/issues/16#issuecomment-1176953638 I'v encountered

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

fenguoerbian commented 2 years ago

I know, this is what I'm doing right now. But this means I have to download and edit the source code in order to successfully build the vignettes for this package instead of build it along the installation process.

That's why I'm curious why the code design differs for windows and linux, why not both use Sys.which("sas") to check for the excecuteable.

Also speaking of vignettes, the cran version seems to not include any vignettes and the github version defaults to build_vignettes = FALSE in install_github. So people will likely end up with no vignettes after installing this package, which is not what it implies in Readme.

Hemken commented 2 years ago

Merged fenguoerbian's find_sas() fix.