BookmarkSubscribeRSS Feed
crissietan
SAS Employee

My RLANG System Option has already determined that I am able to call R from SAS System.

 

I have also set up R_HOME environment variable that points to the correct directory that contains LibR.so. This has been correctly configured on the config file that RLANG System Option value stated.

 

These are the codes that I have submitted on the studio (I tried both):

proc options option=RLANG value;
run;

options set=R_HOME='/opt/anaconda3/lib/R';
%put %sysget(R_HOME);

proc iml;
/* Comparison of matrix operations in IML and R */
print "----------  SAS/IML Results  -----------------";
x = 1:3;                                 /* vector of sequence 1,2,3 */
m = {1 2 3, 4 5 6, 7 8 9};               /* 3 x 3 matrix */
q = m * t(x);                            /* matrix multiplication */
print q;
print "-------------  R Results  --------------------";
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;
quit;

While my result for SAS/IML successfully displayed on output, the moment I placed the R results code in, the program keeps being on running mode for long hours and it is on loop. Is there any way to resolve this issue since there is no error log found and the settings were done correctly?

2 REPLIES 2
ballardw
Super User

Did you try running the two bits of code as separate calls to proc Iml?

proc iml;
/* Comparison of matrix operations in IML and R */
print "----------  SAS/IML Results  -----------------";
x = 1:3;                                 /* vector of sequence 1,2,3 */
m = {1 2 3, 4 5 6, 7 8 9};               /* 3 x 3 matrix */
q = m * t(x);                            /* matrix multiplication */
print q;

quit;

proc iml;
print "-------------  R Results  --------------------";
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;
quit;
crissietan
SAS Employee

Hi there,

I managed to run the two bits of code as separate calls to proc iml. I was able to get real time and cpu time of the SAS/IML Results, but not R Results. This is what I have on the log so far when I run the whole code.

 

1     OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
75    
76    proc options option=RLANG;
77    run;
    SAS (r) Proprietary Software Release V.03.04  TS1M0
 RLANG             Enables SAS to execute R language statements.
NOTE: PROCEDURE OPTIONS used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      
78    
79    proc iml;
NOTE: IML Ready
80    /* Comparison of matrix operations in IML and R */
81    print "----------  SAS/IML Results  -----------------";
82    x = 1:3;
82  !                                          /* vector of sequence 1,2,3 */
83    m = {1 2 3, 4 5 6, 7 8 9};
83  !                                          /* 3 x 3 matrix */
84    q = m * t(x);
84  !                                          /* matrix multiplication */
85    print q;
86    quit;
NOTE: Exiting IML.
NOTE: The PROCEDURE IML printed page 1.
NOTE: PROCEDURE IML used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      
87    
88    proc iml;
NOTE: IML Ready
89    print "-------------  R Results  --------------------";
90    submit / R;
91      rx <- matrix( 1:3, nrow=1);             # vector of sequence 1,2,3
92      rm <- matrix( 1:9, nrow=3, byrow=TRUE); # 3 x 3 matrix
93      rq <- rm %*% t(rx);                     # matrix multiplication
94      print(rq);
95    endsubmit;

As you can tell, the SAS Studio is just running the code for R Results without any error nor completion and it has been like this for more than an hour. This is how it looks like currently after I submitted the two bits of code on SAS Studio V. It just keeps running.

 

runningtoolong.png

sas-innovate-2024.png

 

Secure your spot at the must-attend AI and analytics event of 2024: SAS Innovate 2024! Get ready for a jam-packed agenda featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.

 

Register by March 1 to snag the Early Bird rate of just $695! Don't miss out on this exclusive offer. 

 

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
  • 2 replies
  • 519 views
  • 0 likes
  • 2 in conversation