I was wondering if anyone had experience with SAS/IML and R, and can give some pointers as to the relative advantages/disadvantages of the two. I've used R extensively for programming and statistical analyses, but haven't had much experience with IML. However, as this company is a SAS shop, I'm likely to have to use it (the alternative is to program everything in base SAS, which sometimes leads to true horrors).



3 Answers 3


Full disclosure: I work at SAS.

The IML blog is http://blogs.sas.com/iml.

Both languages are matrix-vector languages with a rich run-time library and the ability to write your own functions. For data analysis tasks and matrix computations, they both provide the neccessary tools to help you analyze your data.

The SAS/IML syntax is very similar to the SAS DATA step, so it appeals to SAS programmers. You can also call all of the SAS DATA step functions, and you can call any SAS procedure from within SAS/IML by using the SUBMIT/ENDSUBMIT statements. The SAS/IML Studio application is very nice for developing programs and for creating graphics.

The R community creates and shares a large number of packages, including packages written by top academic researchers. New statistical methods appear in R very quickly. The R community has many help and discussion lists.

The SAS/IML language does not contain every statistical analysis (as a built-in function) because the assumption is that you will call SAS/STAT or SAS/ETS procedures when you need a specialized analysis. For example, SAS/IML does not have functions for mixed modelling, but you can prepare the data in SAS/IML, call the MIXED or GLIMMIX procedure, and then use IML some more to manipulate or modify the output from the procedure.

In chapter 11 (and 16) of my book, I show how to call R from SAS/IML, transfer data back and forth, and generally show how to get the best of both worlds.


You might want to pick up (or look at) a copy of Rick Wicklin's book: Statistical Programming with SAS IML software


He also has a blog about IML.

And, on SAS' site, there is a section about IML:


And you will want IMLStudio, which offers a multiple window view that is much easier to integrate with Base SAS than the old IML was.

I have used Base SAS and SAS Stat a lot. I've only barely looked at IML. But, from what I've seen, your knowledge of R should help.


I have never used it, but I know for new versions of IML, you can call R routines. Maybe start by looking at http://support.sas.com/rnd/app/studio/statr.pdf.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.