Hi im new in sas and im trying to run an R code in Sas studio:
proc iml;
submit / r;
x<-y+5
endsubmit;
I keep getting this error:
ERROR: SAS could not initialize the R language interface.
ERROR: The R_HOME environment variable was not found.
i already have rlang activated.
Thanks!
Thanks for confirming that the RLANG system option is set. Because the SAS server is running on Linux, the next thing to do is for the admin to define the R_HOME environment variable to point to the path of your R installation directory. This is explained in the doc "Installing R on Linux Operating Systems."
There are additional admin tips in Gilsen (2019), which was presented at the 2019 SAS Global Forum.
Can you say more about how you are running SAS?
1. Are you running SAS University Edition?
2. If the answer to #1 is "no," are you connected to a local SAS server on your PC or to a remote SAS server on linux?
Hi Rick, thanks for answering:
1-im running Sas 3.8 ( its not university)
2-im connected to a remote SAS server on linux
OK, then I think this an issue you need to address with your SAS network administrator. I doubt you have the authority/permission to configure the SAS server. The admin needs to start the SAS server with the -RLANG option. Here is a section of the documentation that you can send to your administrator.
Rick, the admin has already started the sas server with the rlang but i still have the error.
maybe its an issue of R version (3.5.2) or where its installed?
Thanks
Please run the following and post the SAS log:
proc options option=rlang value; run;
Thanks for confirming that the RLANG system option is set. Because the SAS server is running on Linux, the next thing to do is for the admin to define the R_HOME environment variable to point to the path of your R installation directory. This is explained in the doc "Installing R on Linux Operating Systems."
There are additional admin tips in Gilsen (2019), which was presented at the 2019 SAS Global Forum.
Thanks Rick! i will contact the admin for this
My Admin has carefully performed the two steps mentioned by Rick_SAS, that is.
However, although the "proc options option=rlang value; run;" shows that RLANG is ENABLE; the SAS code with (only) the R script indicated below keeps giving me the following error message.
x<-y+5;
endsubmit;
quit;
Do you guys have any thought on the source(s) of this problem?
The error message says that SAS is trying to load the R code from
/opt/R/3.6.3/lib/libR.so
and that file does not exist.
I am not a linux system administrator, but I think many people install R in /usr/lib/R.
1. Did you successfully install R on Linux from the CRAN source? That is, you are using the official CRAN source, not Anaconda or another third-party version?
2. Can you run R from the R GUI?
I doubt I will be able to help resolve this installation issue. I've never installed R on Linux from CRAN.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.