Video: Calling R from the SAS/IML Language

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.

tags: 9.22, R, Statistical Programming, Tips and Techniques

2 Trackbacks

  1. [...] I call R from within the SAS/IML language, I often pass parameters from SAS into R. This feature enables me to write general-purpose, [...]

  2. [...] to call R from SAS has been available in SAS/IML since 2009. Previous blog posts about R include a video on how to call R from the SAS/IML language and a detailed example of calling R and importing the results back into SAS. The SAS/IML interface [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <p> <pre lang="" line="" escaped=""> <q cite=""> <strike> <strong>