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

I have SAS Enterprise Guide 4.3 installed on my computer. It is connected to a SAS 9.3 on a server. This work great but if I get an error when I run a SAS program calling R. The server administrator modified the sasv9.cfg file in order to include the -RLANG option. I executed my code in batch on the server and here is the log:

1      PROC OPTIONS OPTION=RLANG;
2      RUN;

SAS (r) Proprietary Software Version 9.3  TS1M0

RLANG        
Support access to R language interfaces

NOTE: PROCEDURE OPTIONS used (Total process time):

  real time       0.00 secondes
  cpu time        0.00 secondes

3    
4      PROC IML;

NOTE: IML Ready

5            SUBMIT / R;
6            a <- 2
7            paste("a:",a)
8            b <- 3
9            paste("b:",b)
10           c <- a * b
11           paste("c:",c)
12     ENDSUBMIT;
13     QUIT;

NOTE: Exiting IML.

NOTE: The PROCEDURE IML printed page 1.

NOTE: PROCEDURE IML used (Total process time):

  real time       0.24 secondes
  cpu time        0.03 secondes

If you executre the same code within SAS Enterprise Guide on the same server, the log is:

15     PROC OPTIONS OPTION=RLANG;
16     RUN;

SAS (r) Proprietary Software Version 9.3  TS1M0

RLANG         Support access to R language interfaces

NOTE: PROCEDURE OPTIONS used (Total process time):

  real time       0.00 secondes
  cpu time        0.00 secondes

17   
18     PROC IML;

NOTE: IML Ready

19           SUBMIT / R;
20           a <- 2
21           paste("a:",a)
22           b <- 3
23           paste("b:",b)
24           c <- a * b
25           paste("c:",c)
26     ENDSUBMIT;

ERROR: SAS could not initialize the R language interface.

statement : SUBMIT at line 19 column 7

27     QUIT;

NOTE: Exiting IML.

I don't understand why it doesn't give the same results. I already had the same error in batch when R_HOME was not defined.

1 ACCEPTED SOLUTION

Accepted Solutions
TimB_SAS
SAS Employee

They key is likely in your statement, "I already had the same error in batch when R_HOME was not defined"

From EG, submit :  %put %sysget(R_HOME) ;  is the correct path returned?   If not, you'll need to modify one of the SAS start-up scripts to define it.  A good place would be <SASHOME>/SASFoundation/9.x/bin/sasenv_local, as this file will be sourced by all SAS sessions launched on the system.

View solution in original post

4 REPLIES 4
Doc_Duke
Rhodochrosite | Level 12

My guess is that the R subsystem is run using the equivalent of an 'x' command.  By default, "X" commands are not supported via EGuide.  If so, that's why it is being blocked.  The system administrator can allow execution of "X" commands under EGuide.

You may want to call tech support for confirmation.

Doc Muhlbaier

Duke

Rick_SAS
SAS Super FREQ

No, we do not use the 'X' command to call R.

I can run your program in EG 4.3 without error, so the problem is particular to your configuration. Please contact Technical Support so they can help you resolve this problem.

TimB_SAS
SAS Employee

They key is likely in your statement, "I already had the same error in batch when R_HOME was not defined"

From EG, submit :  %put %sysget(R_HOME) ;  is the correct path returned?   If not, you'll need to modify one of the SAS start-up scripts to define it.  A good place would be <SASHOME>/SASFoundation/9.x/bin/sasenv_local, as this file will be sourced by all SAS sessions launched on the system.

Alain
Calcite | Level 5

You were right. The system variable R_HOME was no more defined. I modified the sasenv_local as suggested and now it works.

Thank you.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 5188 views
  • 1 like
  • 4 in conversation