BookmarkSubscribeRSS Feed
Reeza
Super User

Note that Anaconda has no issues working with the 'two folder' structure and having R located in the Program Files folder.

ODENWALD
Obsidian | Level 7

Reeza :

 

I start with  SAS -- R  . All parts have been checked and work.

Windows Environment variable R_HOME is correctly set.


proc options option= RLANG ; run ;

options set=R_HOME='C:\Users\Username\Anaconda3\R' ;

%put %sysget(R_HOME) ;


filename envcmd pipe 'set' lrecl=1024;
data WORK.Win10_Env_set;
infile envcmd dlm='=' missover;
length name $ 32 value $ 1024;
input name $ value $;
run;


/* If you get a matrix 14, 32, 50 as the result, then it's  OK  */

proc iml;
submit/R;
rx <- matrix( 1:3, nrow=1)
rm <- matrix( 1:9, nrow=3, byrow=TRUE)
rq <- rm %*% t(rx)
print(rq)
endsubmit;
quit;


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;

Tom
Super User Tom
Super User

Looks to me like to get Anaconda to work you need to set the same environment variable R_HOME as SAS needs to work.

 

http://www.swegler.com/becky/blog/2014/08/03/ipython-ipython-notebook-anaconda-and-r-rpy2/

 

Rick_SAS
SAS Super FREQ

My colleague installed Anaconda this afternoon and got SAS/IML to work with it. Here's what he did:

 

  • Installed Anaconda 4.4.0 for Windows 64.
  • Used the Anaconda Navigator to install RStudio 1.0.136.
  • By looking at the installation directory, it looks like RStudio uses a customized and extended version of R, which is installed in C:\Users\USERNAME\AppData\Local\Continuum\Anaconda3\R
  • In addition to the Anaconda3\R directory, the directory contains an Anaconda3\Library\mingw-w64\bin directory that includes extra files and DLLs. For example, the file zlib1.dll lives in this directory; I include that name because it is at the bottom of an alphabetical listing.

Here is what my colleague did to get SAS to work:

  1. Add the DLL directory to the Windows PATH environment variable. You can do this through Window Control Panel: System and Security, System, Advanced system settings, Environment Variables. Click PATH and Edit button.
  2. Set R_HOME to be the Anaconda3\R directory. You can do this through Window Control Panel (as above) or from the SAS command line:
    -SET R_HOME "C:\Users\USERNAME\AppData\Local\Continuum\Anaconda3\R"

Appending the DLL directory to the PATH environment variable seems to be the step that most people would not know to do.  Do Steps (1) and (2) before launching SAS

 

Disclaimer: we did this on one machine. We did not test the installation extensively. This is not a version of R that SAS officially supports. 

 

I hope this information will be useful to someone. Your installation directories might vary.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 18 replies
  • 2968 views
  • 1 like
  • 4 in conversation