Statistical programming, matrix languages, and more

SAS IML Error: An installed version of R could not be found.

Accepted Solution Solved
Reply
Contributor KAZ
Contributor
Posts: 25
Accepted Solution

SAS IML Error: An installed version of R could not be found.

I am attempting to run R from proc iml and am getting the following error:

 

ERROR: An installed version of R could not be found.

 

I am running:

 

R 3.2.3 64bit

SAS 9.4 (TS1M2)

SAS/IML 13.2

 

on Windows x64 7pro.

 

From everythign I've read, IML 13.2 is compatible with R 3.2.x.  Is SAS relying on a system path variable or something else that I am missing?

 

Thanks.


Accepted Solutions
Solution
‎04-26-2016 11:16 AM
SAS Super FREQ
Posts: 3,624

Re: SAS IML Error: An installed version of R could not be found.

If R is installed in a nonstandard location (or if you have multiple copies of R and you want SAS to use a particular version), you can define the R_HOME environment variable. How you do that depends on the version of Windows that you are running, but hopefully this Windows 7 example will point you in the right direction.

 

From Control Panel, search for "environment." Click on the link that says something like "Edit environment variables for your account". (On Windows 7, it is on the System Properties dialog, on the Advanced Tab, click Environment Variables.)

Region Capture.png

 

Click New in the top section for "user variables."  Type R_HOME for the Variable name field and the full path of your R installation for the Variable value field.

 

Window Capture.png

 

View solution in original post


All Replies
SAS Super FREQ
Posts: 3,624

Re: SAS IML Error: An installed version of R could not be found.

How are you calling PROC IML? From EG? The SAS Windowing environment (DMS)? Other?

 

R should be installed on the same computer that is executing SAS. So, for example, if you are running SAS through EG and connecting to a remote SAS server, then R needs to be installed on that server. If you install it on your local (client) PC, the SAS server will not be able to locate R.

 

Contributor KAZ
Contributor
Posts: 25

Re: SAS IML Error: An installed version of R could not be found.

Everything, SAS and R, is running on my Windows machine.

 

My sasv9.cfg file in SASHome\SASFoundation\9.4 directoy reads:

 

-RLANG
-config "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg"

 

But when I run:

proc options option=RLANG;  run;

 

The NORLANG options is reported.

 

SAS Super FREQ
Posts: 3,624

Re: SAS IML Error: An installed version of R could not be found.

I'm confused. What has changed? This is a different error than you originally reported. The original problem seemed to say "you have permission to call R, but SAS can't find it."  Now you are telling us that you don't have permission to run R.

 

At any rate, I have had good sucess with putting -RLANG and -MEMSIZE 12GB in my

"C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg" file.

 

You have not told us how you are calling SAS.  The three common options are Enterprise Guide (EG), SAS Studio (web based), or native SAS Windowing environment (DMS).

 

Contributor KAZ
Contributor
Posts: 25

Re: SAS IML Error: An installed version of R could not be found.

I am running the native SAS windowing environment (DMS).

 

Nothing has changed.  The follwoing code:

 

proc options option=RLANG; run;

 

returns NORLANG in the log.  If I try to run R from proc IML such as :

 

proc iml;
submit / R;
  rx <- matrix( 1:3, nrow=1)             # vector of sequence 1,2,3
  rm <- matrix( 1:9, nrow=3, byrow=TRUE) # 3 x 3 matrix
  rq <- rm %*% t(rx)                     # matrix multiplication
  print(rq)
endsubmit;
run;
quit;

 

I get the following error:

 

ERROR: The RLANG system option must be specified in the SAS
       configuration file or on the SAS invocation command line to
       enable the submission of R language statements.

SAS Super FREQ
Posts: 3,624

Re: SAS IML Error: An installed version of R could not be found.

Great. I'm just saying that you are now getting a different error than you originally stated. 

 

Add -RLANG to your sasv9.cfg file. Exit SAS.

 

Re-run SAS and try

proc options option=RLANG value;

run;

 

The VALUE option should tell you that RLANG was set in your config file. If it doesn't, you might need to ask a system administrator whether there are other config files that run after yours. 

 

Alternatively, click RMB on the SAS icon on your desktop of Start menu. Select "Properties" and add -RLANG to the Target command line in the "Properties" dialog box.  Maybe the command line has -NORLANG specified, which would override the option.

Contributor KAZ
Contributor
Posts: 25

Re: SAS IML Error: An installed version of R could not be found.

Thanks.  I aplogize for the confusion. 

 

In my start menu, the target for the SAS icon was:

"C:\Program Files\SASHome\SASFoundation\9.4\sas.exe" -CONFIG "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg"

 

and I added the -RLANG option in the prior config file.  I launched SAS with:

"C:\Program Files\SASHome\SASFoundation\9.4\sas.exe" -CONFIG "C:\Program Files\SASHome\SASFoundation\9.4\sasv9.cfg"

 

And now the RLANG option is regonized:

 

proc options option=RLANG value; run;
Option Value Information For SAS Option RLANG
    Value: RLANG
    Scope: SAS Session
    How option value set: Config File
    Config file name:
            C:\Program Files\SASHome\SASFoundation\9.4\sasv9.cfg

 

Now I received the original error message when I try to call R:

 

2
3    proc iml;
NOTE: Writing HTML Body file: sashtml.htm
NOTE: IML Ready
4    submit / R;
5      rx <- matrix( 1:3, nrow=1)             # vector of sequence 1,2,3
6      rm <- matrix( 1:9, nrow=3, byrow=TRUE) # 3 x 3 matrix
7      rq <- rm %*% t(rx)                     # matrix multiplication
8      print(rq)
9    endsubmit;
ERROR: SAS could not initialize the R language interface.

 statement : SUBMIT at line 4 column 1
10   run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
11   quit;
NOTE: Exiting IML.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IML used (Total process time):
      real time           2.06 seconds
      cpu time            0.46 seconds


ERROR: An installed version of R could not be found.

 

SAS Super FREQ
Posts: 3,624

Re: SAS IML Error: An installed version of R could not be found.

What is the location in which you have installed R?  For example, my version of R is installed in

C:\Program Files\R\R-3.2.2

Contributor KAZ
Contributor
Posts: 25

Re: SAS IML Error: An installed version of R could not be found.

Ah, now we are getting somewhere.

 

I just noticed R is installed in my My Documents directory. 

 

How do I tell SAS to look for it there?

Solution
‎04-26-2016 11:16 AM
SAS Super FREQ
Posts: 3,624

Re: SAS IML Error: An installed version of R could not be found.

If R is installed in a nonstandard location (or if you have multiple copies of R and you want SAS to use a particular version), you can define the R_HOME environment variable. How you do that depends on the version of Windows that you are running, but hopefully this Windows 7 example will point you in the right direction.

 

From Control Panel, search for "environment." Click on the link that says something like "Edit environment variables for your account". (On Windows 7, it is on the System Properties dialog, on the Advanced Tab, click Environment Variables.)

Region Capture.png

 

Click New in the top section for "user variables."  Type R_HOME for the Variable name field and the full path of your R installation for the Variable value field.

 

Window Capture.png

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 9 replies
  • 958 views
  • 0 likes
  • 2 in conversation