BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ManuelaVila
Fluorite | Level 6

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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.

View solution in original post

10 REPLIES 10
Rick_SAS
SAS Super FREQ

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?

ManuelaVila
Fluorite | Level 6

Hi Rick, thanks for answering:

1-im running Sas 3.8 ( its not university) 

2-im connected to a remote SAS server on linux

 

 

Rick_SAS
SAS Super FREQ

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.

ManuelaVila
Fluorite | Level 6

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 

Rick_SAS
SAS Super FREQ

Please run the following and post the SAS log:

proc options option=rlang value; run;
ManuelaVila
Fluorite | Level 6
 
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 proc options option=rlang value; run;
 
SAS (r) Proprietary Software Release 9.4 TS1M6
 
Información del valor de la opción para la opción SAS RLANG
Valor:RLANG
Scope: SAS Session
How option value set: Config File
Config file name:
/opt/sas/SASHome/SASFoundation/9.4/sasv9.cfg
 
NOTE: PROCEDURE OPTIONS ha utilizado (Tiempo de proceso total):
real time 0.00 seconds
cpu time 0.00 seconds
 
 
74
75 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
87
Rick_SAS
SAS Super FREQ

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.

ManuelaVila
Fluorite | Level 6

Thanks Rick! i will contact the admin for this 

econtreras
Calcite | Level 5

My Admin has carefully performed the two steps mentioned by Rick_SAS, that is.

  1. Start the SAS server with the -RLANG option; according to:
    https://go.documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.3&docsetId=imlug&docsetTarget=iml...
  2. Define the R_HOME environment variable to point to the path of your R installation directory; according to:
    https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2019/3556-2019.pdf

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.

 

ERROR: SAS could not initialize the R language interface.
ERROR: The R shared library could not be loaded: /opt/R/3.6.3/lib/libR.so
 
 
proc iml;
submit / r;
------------------ R script ----------------

x<-y+5;
endsubmit;
quit;

 

Do you guys have any thought on the source(s) of this problem?

Rick_SAS
SAS Super FREQ

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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Multiple Linear Regression in SAS

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.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 10 replies
  • 3058 views
  • 1 like
  • 3 in conversation