Statistical programming, matrix languages, and more

SAS , R and Anaconda

Reply
Occasional Contributor
Posts: 12

SAS , R and Anaconda

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

SAS Super FREQ
Posts: 3,488

Re: SAS , R and Anaconda

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.

Occasional Contributor
Posts: 12

Re: SAS , R and Anaconda

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

 

SAS Super FREQ
Posts: 3,488

Re: SAS , R and Anaconda

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?

Occasional Contributor
Posts: 12

Re: SAS , R and Anaconda

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.

 

 

Super User
Posts: 17,928

Re: SAS , R and Anaconda

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. 

Occasional Contributor
Posts: 12

Re: SAS , R and Anaconda

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

Super User
Posts: 17,928

Re: SAS , R and Anaconda

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. 

 

 

 

 

Occasional Contributor
Posts: 12

Re: SAS , R and Anaconda

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

Super User
Posts: 17,928

Re: SAS , R and Anaconda

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.

Super User
Posts: 17,928

Re: SAS , R and Anaconda

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

Occasional Contributor
Posts: 12

Re: SAS , R and Anaconda

Reeza :

 

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

 

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

 

Odenwald

Super User
Posts: 17,928

Re: SAS , R and Anaconda


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) ;
Occasional Contributor
Posts: 12

Re: SAS , R and Anaconda

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

 

 

Super User
Posts: 17,928

Re: SAS , R and Anaconda

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.

Ask a Question
Discussion stats
  • 18 replies
  • 368 views
  • 1 like
  • 4 in conversation