BookmarkSubscribeRSS Feed
Rick_SAS
SAS Super FREQ

I don't know, but the problem is probably in your data. Try the following test, which uses one of the standard R data frames:

 

proc options option=rlang VALUE; run ;

PROC IML ;
submit / R ;
RData <- iris        # built-in data set
is.data.frame(RData)
endsubmit ;
	call ImportDataSetFromR("Work.Mydata", "RData");
use Work.Mydata ;
show contents;
close Work.Mydata ;

jkurka
Fluorite | Level 6

Thank you Rick, but running this test provided the same result. The code runs successfully, but no data set is created in the Work directory and no output is provided by SAS. I've tested this using SAS Enterprise Guide and base SAS 9.4.

 

I'm now thinking there is some error on how SAS is talking to R.

This is what's included in my configuration file, which is located at C:\Program Files\SASHome\SASFoundation\9.4

-RLANG
-config "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg"
-SET R_HOME "C:\PROGRAM FILES\R\R-3.5.1\bin"

The R_HOME path contains the 'R.exe' file and the 'Rscript.exe' file.

The VALUE option you included results in these log statements:

Value: RLANG
Scope: SAS Session
How option value set: Config File
Config file name:
C:\Program Files\SASHome\SASFoundation\9.4\sasv9.cfg

When I run:

%put %sysget(R_HOME) ;

I get this statement in the log:

C:\PROGRAM FILES\R\R-3.5.1\bin

 

Thank you for your continued support and patience! I appreciate any assistance you provide.

Rick_SAS
SAS Super FREQ

I think the R_HOME environment variable must point to the root directory of the R installation, not to the "bin" subdirectory.

jkurka
Fluorite | Level 6

Hi Rick,

 

I originally had the root directory 'C:\Program Files\R\R-3.5.1'. I tried referring to the subdirectory thinking that the path might need to have the actual R executable file. Neither have worked. Are you able to share some of your configurations and output using the same code so I can compare?

 

Thank you again!

Rick_SAS
SAS Super FREQ

It looks like you are running Windows and that both SAS and R are installed on the same PC, right?

 

Please post

1. Version of SAS

2. Bitness (32-bit or 64-bit)

4. Bitness of R (it better match the bitness of SAS!)

5. How you are calling SAS (EG? Windows DMS? SAS/IML Studio? SAS Studio? University Edition?)

6. Let's make sure that R is being found. Run the following simple program and post the results:

proc iml;
submit / R;
  x <- 1:5
  x
endsubmit;
run ImportMatrixFromR(y, "x");
print y;

 

DWilson
Pyrite | Level 9

Put

quit;

 

at the end of your proc IML statement?

 

 

If that doesn't work, we also terminate our R commands with semi-colons. I'm not sure why we do that as semicolons are optional but you could try that and see if maybe R is having a hard time parsing your various R statements.

 

 

 

DWilson
Pyrite | Level 9

Also, this may be a stretch, but if your IML code is imbedded in a SAS macro then we've found that we cannot include submit blocks directly in the proc iml. We have to put the submit blocks in files that we %include within the proc iml call.

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 21 replies
  • 2968 views
  • 2 likes
  • 4 in conversation