SAS 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.UPDATE: The current version of SAS supports R 4.2.0, which was released on 22APR2022. Some older versions of SAS only support up to R 3.6.3, which was released in March 2020. You must download a hot fix to use R 4.x.y on these older versions. In the following table, an asterisk indicates that a hot fix is required.
|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.2.0|
|9.4M8||15.3||N/A||Aug 2022 (Tent)||4.0.0 - 4.2.0|
In addition, SAS IML on SAS Viya supports the latest version of R.
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:
- NEW 24MAY2023: 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.
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.