SAS 9 has supported calling R from the SAS/IML language since 2009. The interface to R is part of the SAS/IML language. However, there have been so many versions of SAS and R since 2009, that it is hard to remember which SAS release supports which versions of R. The following table lists recent SAS releases and the versions of R that each supports. Rick Wicklin tries to keep this page up to date as new versions of SAS 9 and R are released.
UPDATE: The current version of SAS supports R 4.4.0. For some older versions of SAS, you must download a hot fix to use the latest version of R. In the following table, an asterisk indicates that a hot fix is required. Details are provided in the section "Incompatible Versions."
SAS Version | PROC IML | SAS/IML Studio | Release Date | R Versions |
---|---|---|---|---|
9.2 | N/A | 3.2 | Jul 2009 | 2.6.1 - 2.11.1 |
9.22 | 9.22 | 3.3 | Nov 2010 | 2.9.1 - 2.11.1 |
9.3 | 9.3 | 3.4 | Jul 2011 | 2.9.1 - 2.15.3 |
9.3M2 | 12.1 | 12.1 | Aug 2012 | 2.9.1 - 2.15.3 |
9.4 | 12.3 | 12.3 | Jul 2013 | 2.13.0 - 3.0.1 |
9.4M1 | 13.1 | 13.1 | Dec 2013 | 2.13.0 - 3.2.5 |
9.4M2 | 13.2 | 13.2 | Aug 2014 | 2.13.0 - 3.2.5 |
9.4M3 | 14.1 | 14.1 | Aug 2015 | 2.13.0 - 3.2.5 |
9.4M4 | 14.2 | 14.2 | Nov 2016 | 2.13.0 - 3.6.3 |
9.4M5 | 14.3 | 14.3 | Sep 2017 | 2.13.0 - 3.6.3* |
9.4M6 | 15.1 | 15.1 | Nov 2018 | 2.13.0 - 3.6.3* |
Hot Fix* | 14.3-15.2 | Feb 2021 | R 4.0.x | |
9.4M7 | 15.2 | N/A | Aug 2020 | 4.0.0* - 4.4.0 |
9.4M8 | 15.3 | N/A | Aug 2022 | 4.0.0 - 4.4.0 |
In addition, SAS IML on SAS Viya supports the latest version of R.
Incompatible Versions
SAS ensures that each SAS release supports backward compatibility with as many previous R releases as possible. However, after a version of SAS ships, it is impossible to ensure forward compatibility. To date, the following releases of R broke compatibility with a prior SAS release:
- R 4.3.0 broke compatibility when it eliminated default.stringsAsFactors(). Some R programs might give the error ERROR: R: 'default.stringsAsFactors' is defunct. You can read the R Core Team's reasons for eliminating the function. SAS has fixed the problem in SAS IML on Viya. You can download a hotfix for SAS 9.4M7 and 9.4M8 from Note 70253.
- R 4.0 broke compatibility with all SAS releases on Linux. When you try to run R from SAS/IML, you might get error messages that include "ERROR: The final R statement is incomplete" and "ERROR: SAS is unable to transcode character data to the R encoding." You can download a hot fix that resolves the issue for SAS 9.4 M5, M6, and M7. The problem is fixed in SAS 9.4M8.
- On Windows, R 3.3.0 broke compatibility with SAS/IML 14.1 (SAS 9.4m3) and earlier releases. The interface works on Linux. R 3.3.0 requires Red Hat Linux (RHEL) 7.1, so SAS customers who run an older Linux release might need to upgrade the operating system before they can compile R 3.3.0.
- R 3.0.2 changed an internal detail that SAS was using. SAS/IML 13.1 supports R 3.0.2.
- R 3.0.0 changed certain aspects of the external API to R. To use R 3.0.0 or later you must use SAS 9.4 or later.
- R 2.12.0, which introduced 64-bit R, changed the locations of certain libraries. To use R 2.12.0 or later, you must use SAS 9.3 or later.
An error message that you might see because of incompatible versions is "An installed version of R could not be found," although this message can also occur for other reasons.
Some software companies distribute their own versions of R, but SAS does not. Consequently, if the interface to R changes, SAS customers need to use a compatible version of R until they can update their version of SAS.
32-bit and 64-bit versions of SAS and R
I'll close with a few comments about 32-bit and 64-bit versions of SAS and R.
- If you are using a version of SAS/IML prior to 9.3, you must install a 32-bit version of R. If you are using SAS/IML 9.3 or later, read on.
- If you are using SAS software on a 32-bit edition of Windows, you must install the 32-bit edition of R.
- If you are using SAS software on a 64-bit edition of Windows, you can install either the 32-bit or the 64-bit edition of R. The 32-bit edition of SAS looks first for the 32-bit edition of R and then for the 64-bit edition. The 64-bit edition of SAS looks first for the 64-bit edition of R and then for the 32-bit edition.
Anaconda R
Since this article was published, some companies have tried to interface between SAS and Anaconda R on Linux. SAS does not support Anaconda R. SAS supports R that is installed and built from the CRAN source.
25 Comments
Rick,
If I still have several versions of R installed on my Windows machine, is it possible to have SAS call an older (compatible) version of R, instead of the most current one? Thanks.
Yes. If the environment variable R_HOME exists, SAS/IML loads R from the specified directory. So set R_HOME to point to the root directory of the R installation that you want (NOT the "bin" subdirectory).
Pingback: Twelve advantages to calling R from the SAS/IML language - The DO Loop
Rick:
Any predictions about upcoming versions of SAS/IML particularly with respect to the R interface? I'm doing my annual negotation with our university IT department regarding software to install for the 2014/15 academic year.
Last year we got caught in the trap of having SAS 9.3 and R 3.0 meaning I could not teach students about calling R from SAS/IML. At the moment current R is 3.1.0 (with no planned date for the next release) and current SAS is 9.4m1; if I am correct. I presume those two are compatible; can you confirm?
Are there plans for a summer SAS release?
Yes, SAS/IML 13.1 can call R 3.1.0. The next release of SAS/IML is 13.2 in summer 2014. It also supports R 3.1.0.
Rick,
I have Eminer 13.1 and R 3.1.1, but I don't have IML, can I run R using the Open Source Integration node? If so you have a simple example for this? I have my R_HOME set to the R directory and have the -RLANG set in my sasv9.cfg, but it's not working.
You can try the instructions in this article. Contact Technical Support if you still have problems.
Hi Rick,
Think I need some help? I had the 9.3 version, and now switched to the new 9.4. It was working fine when calling R with SAS/IML studio 3.4. Now I have the 13.2, and I have the sentence :
"An installed version of R could not be found. (+2, 16)"
But it is on the computer. As reported in your table I check and changed R versions, but it is always the same.......
Any ideas will be welcome. Is there a way to define the directory in which R is installed ?
Best
Philippe
Contact SAS Technical Support and provide them with details such as version of R, operating system, and SAS. Also report bitness (32 or 64) for Windows, SAS, and R.
Thanks Rick. Will do that
Rick - any chance at getting a "last updated date:" and/or a "highest version of R tested:" field in the table/post above? You're clearly updating it, but it would be helpful to know the last time it was updated to know whether we need to verify a particular version or not. (Or, the presumably sourced-from-here KB article could have the same thing - by the way, that kb article is slightly out of date versus this.) Thanks!
In the table, "present" means the latest release. When each version of R is released, we run a suite of SAS/IML tests and this post is updated within a few days if anything changes.
I understand that, but the problem is that it's not obvious what "present" corresponds to - it's not obvious to a reader that the version on the R website is definitively tested (and if you took a few weeks off to go to the Cayman Islands, and R released a new version during that time, it would be hard to know that it was tested). It's helpful on lists like this to have a "last updated" date and/or a "last tested version" number to make that more clear, particularly to someone who doesn't read down in the comments.
Thanks for updating the post with the last version of R tested!
My company currently uses SAS Enterprise Guide on a dedicated SAS server. After installing SAS/IML on out server, would we then need to separately install R or can we already call R with proc iml?
I've inquired with my company's IT Dept about installing R on our SAS server, but was told it wasn't possible (or would be very difficult).
SAS and R need to be installed on the same machine. SAS does not distribute R, so your IT Dept would need to install it.
I have Base SAS, SAS IML, and SAS EG installed on my PC. After editing the SASv9 config file, I was able to access R within Base SAS and SAS IML, however, I am still getting the "NORLANG" message on SAS EG. To reiterate, SAS EG is downloaded on my computer and I do not access it from a server. How can I get this working in SAS EG?
Even though I had SAS EG installed on my PC, I was still connected to the server. After switching out of my profile and off the server, it allowed me to access R
Glad you got it working.
Could you know which is the PMML/XML version supported to 9.4M6 EM 15.1? The SAS Note is not updated to this version: https://support.sas.com/kb/54/806.html
No, I do not, but you can find out from SAS Technical Support.
Hi Rick - do you know if Base SAS 9.4 TS1M7 added R version 4 compatibility? Thanks!!
I have updated this post in response to your question. To run R 4.0.x, you have to download and install a hot fix.
Hi, I am getting this message “tkrproxy64.exe has stopped working” while using proc iml statement to read large R data file in SAS (9.4). Can anyone tell why I am getting this message. Thanks
It's not clear what is happening. You say this happens while reading a large data file, so it's possible that R and/or the R interface ran out of memory. If you are familiar with PowerShell and the Windows logs, you can use something like "get-winevent" diagnostic tool (https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.diagnostics/get-winevent?view=powershell-7.3) and use it to find tkrproxy64.exe entries. You might need to open a ticket with Tech Support and share more details with them.