BookmarkSubscribeRSS Feed
ODENWALD
Obsidian | Level 7

Hi :

 

Anaconda is a highly rated distribution in the world of Data Science and Python. You can install and run R and R Studio side by side with Python.

Question :  Could anyone access R in path   C:\Users\Username\Anaconda3\R  from  SAS/IML (there is no further subfolder for R-version) ?  Although R and  R Studio are running without problems there appear error messages to the effect that no R is found.

 

Would appreciate some comments.

 

Odenwald

18 REPLIES 18
Rick_SAS
SAS Super FREQ

Define the environment variable R_HOME. If the variable exists, SAS/IML will load R from the specified directory.

Note that the environment variable R_HOME must point to the root directory of the R installation and not to the "bin" subdirectory.

ODENWALD
Obsidian | Level 7

Rick :   I did so (before).

From SAS Log ::

 RLANG             Enables SAS to execute R language statements.

ERROR: SAS could not initialize the R language interface.
ERROR: An installed version of R could not be found.
NOTE: env:R_HOME="C:\Users\Username\Anaconda3\R"
NOTE: DLL:"C:\Users\Username\Anaconda3\R\bin\x64\R.dll"

 

Both NOTEs are from SAS (pasted out of SAS log).

 

So  SAS  has grabbed the right locations.

My guess is that before get going there is read some kind of ini-type information that does not match.

Might be the version number of R  out of the (standard) R-version subfolder that does not exist here.

 

Odenwald

 

Rick_SAS
SAS Super FREQ

OK. I've never used Anaconda. It's possible that the directory structure is different from the CRAN standard. Officially, the CRAN installation is the only configuration that SAS supports, but I will ask around to see if anyone has experience with using the version of R that is distributed with Anaconda.

 

Software is not usually installed in a user's profile. Was "C:\Users\Username\Anaconda3" the suggested location for the install, or did you override the default?

 

I assume that you are running a 64-bit version of SAS on the same desktop PC?

ODENWALD
Obsidian | Level 7

Rick :

 

I assume that you are running a 64-bit version of SAS on the same desktop PC?  ::  YES.

 

Software is not usually installed in a user's profile. Was "C:\Users\Username\Anaconda3" the suggested location for the install, or did you override the default?    ::  This was suggested by the Anaconda Installer and  accepted.

 

 

Reeza
Super User

Anaconda is an IDE for Python. For R, I thought it used RStudio, an IDE for R. You need to point SAS to your actual R installation. It's usually in its own folder under Programs. I can double check my set up when I get into the office later. 

ODENWALD
Obsidian | Level 7

Reeza :

 

At present   R  and the  R dll   are at these places, not in C:\Programs , but running fine  ::

 

NOTE: env:R_HOME="C:\Users\Username\Anaconda3\R"
NOTE: DLL:"C:\Users\Username\Anaconda3\R\bin\x64\R.dll"

 

Because of the huge bulk I wanted to avoid a doubled installation, say on C:  and on G:

 

Odenwald

Reeza
Super User

I'm assuming you're installing under 'username' because you don't have admin privileges on your computer? If so, are you sure the environmental variables exist. 

 

Anyways, I don't have R installed in the Anaconda folder at all, it's under C:\Programs, Python is installed in the Anaconda folder. 

 

 

 

 

ODENWALD
Obsidian | Level 7

Reeza :

 

I chose this location because it was suggested by the Anaconda Installer and  I  accepted. I guess the reason is to make the whole handling more hassle-free (remove troubles when  Install as Admin  was forgotten or users don't have Admin rights).

I checked and  SAS as well as Windows  see the  R_HOME  exactly where it physically resides.

 

Odenwald

Reeza
Super User

Then perhaps post your full SAS code that generate the error. Maybe there's a mistake in there somewhere. All we've seen so far is the errors.

Reeza
Super User

Did you add the RLANG option to your Config file or invocation?

ODENWALD
Obsidian | Level 7

Reeza :

 

Did you add the RLANG option to your Config file or invocation?   ::  YES .

 

Being confirmed by :   proc options option= RLANG ; run ;

 

Odenwald

Reeza
Super User

@ODENWALD wrote:

Reeza :

 

Did you add the RLANG option to your Config file or invocation?   ::  YES .

 

Being confirmed by :   proc options option= RLANG ; run ;

 

Odenwald


I guess I'll take your word for it. Note that I didn't have to set the R_HOME settings, in fact it didn't work when I directed it to the R folder. If I put the path including the version it does work. 

 

I DIDN'T DO THIS AND IT WORKED.

options set=R_HOME='C:\Program Files\R\' ;

%put %sysget(R_HOME) ;

I DID DO THIS AND IT WORKED:

options set=R_HOME='C:\Program Files\R\R-3.3.2' ;

%put %sysget(R_HOME) ;
ODENWALD
Obsidian | Level 7

You have two folders and I (thanks to Anaconda) have one. The starting of SAS/IML to R  seems to be internally programmed  as to requiring two folders may be even the second one containing a version number of R.

 

Is this correct ?

 

If so I see 3 ways :

 

1. To convince  SAS  to  work in the one-folder scenario, too.

2. To convince  Anaconda  to go to a  two-folder scenario.

3. To make a second  R-installation on my PC  just for  SAS  -->  R.

 

Would you agree ?   Or do you see  a 4.th option ?

 

Odenwald

 

 

Reeza
Super User

I would add the version to the R folder - this seems to be standard, not sure why Anaconda dropped the version number, update the R_HOME and I would expect both SAS and Anaconda to work at that point. I think Anaconda also works off R_HOME.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 18 replies
  • 2893 views
  • 1 like
  • 4 in conversation