Video: Calling R from the SAS/IML Language

2

In SAS/IML 9.22 and beyond, you can call the R statistical programming language from within a SAS/IML program. The syntax is similar to the syntax for calling SAS from SAS/IML: You use a SUBMIT statement, but add the R option: SUBMIT / R. All statements in the program between the SUBMIT statement and the next ENDSUBMIT statement are sent to R for execution. This feature has been in SAS/IML Studio for several years, and I have blogged about the four steps to incorporate R into a SAS/IML program.

You can pass data back and forth between SAS and R formats. Calling R enables you to experiment with the latest R package that was mentioned in a journal article or at a recent statistics conference. PROC IML remains running while R executes the statements, and R remains running after each ENDSUBMIT statement. This means that you can interleave SAS/IML and R statements, or even call R in a loop.

If you've been wondering how this feature might be useful in your work, watch this video. (If you don't see the video embedded in your browser, you can go directly to the video on You Tube.) For more details, see the chapter "Calling R from SAS/IML Software" in the SAS/IML User's Guide.

Share

About Author

Rick Wicklin

Distinguished Researcher in Computational Statistics

Rick Wicklin, PhD, is a distinguished researcher in computational statistics at SAS and is a principal developer of PROC IML and SAS/IML Studio. His areas of expertise include computational statistics, simulation, statistical graphics, and modern methods in statistical data analysis. Rick is author of the books Statistical Programming with SAS/IML Software and Simulating Data with SAS.

Back to Top