18

I use R. Every day. I think in terms of data.frames, the apply() family of functions, object-oriented programming, vectorization, and ggplot2 geoms/aesthetics. I just started working for an organization that primarily uses SAS. I know there's a book about learning R for SAS users, but what are some good resources for R users who've never used SAS?

Stephen Turner
  • 4,183
  • 8
  • 27
  • 33
  • care to say why is that book not good enough? – Eduardo Leoni Mar 08 '11 at 23:28
  • 4
    @Eduardo It's in the wrong direction :-). – whuber Mar 08 '11 at 23:43
  • @whuber, well, you might say going from SAS to R is the right direction, but in this instance, you're right, I'm trying to go from R to SAS. – Stephen Turner Mar 09 '11 at 00:05
  • 1
    @Steven Maybe you should start with the IML procedure which is the closest conceptually to R. At least that will get the juices going. http://www.psych.yorku.ca/lab/sas/iml.htm But, I admit there is probably a need for that reverse tome. – Ralph Winters Mar 09 '11 at 00:19
  • Stephen, what kind of programming are you going to be doing? Do you anticipate writing a lot of custom code, or will you mostly be working with fairly standard SAS modules (with "standard" being highly dependent on what your company has shelled out for...) – Matt Parker Mar 09 '11 at 00:50
  • @Stephen I was in an analogous situation 2 months ago with SPSS. The "R for SAS and SPSS Users" book was most unhelpful -- don't buy it! On the other hand, I've borrowed the "SAS and R" book that Peter cited, and thought it looked very useful for learning SAS by translation. – lockedoff Mar 09 '11 at 21:00
  • 2
    On a side note, I code a little in R and mostly in Python and just joined a company that heavily uses SAS. I am making some great inroads after 5 months of getting Python included in our toolbox, displacing SAS in some areas. As you navigate the waters, we should consider starting a Wiki about "How to get your company to adopt something other than SAS/SPSS for analytics". I am finding the cultural issues are far more difficult than simply evangelizing the language or performance differences. – Josh Hemann Mar 10 '11 at 20:29
  • 1
    If you decide to follow up on @RalphWinter's suggestion, you might like the SAS/IML blog: blogs.sas.com/content/iml From SAS/IML you can also call R functions, which might help you in the transition: http://blogs.sas.com/iml/index.php?/archives/140-Calling-R-from-SASIML-Software.html – Rick Sep 02 '11 at 19:26

3 Answers3

20

15 months ago, I started my current job as someone who had been using R exclusively for about 3 years; I had used SAS in my first-ever stats class, loathed it, and never touched it again until I started here. Here's what has been helpful for me, and what hasn't:

Helpful:


  • Colleagues' code. This is the single most useful source, for me. Some of it was very good code, some of it was very bad code, but all of it showed me how to think in SAS.
  • SUGI. Though they are often almost unbearably corny, there is a vast wealth of these little how-to papers all over the Internet. You don't need to look for them; just Google, and they'll present themselves to you.
  • The O'Reilly SQL Pocket Guide, by Gennick. I dodge a lot of SAS coding by using PROC SQL for data manipulation and summarization. This is cheating, and I don't care.
  • This paper explaining formats and informats (PDF). This is without a doubt the least-intuitive part of SAS for me.
  • UCLA's Academic Technology Services' Statistical Computing site. UCLA has heaps of great introductory material here, and there's a lot of parallel material between its R and SAS sections (like these analysis examples).

Not helpful:


  • Anything I've ever read that is intended for people transitioning between R and SAS. I have the "R and SAS" book from Kleinman and Horton, which I've opened twice only to not find the answers I needed. I've read a few other guides here and there. Maybe it's just my learning style, but none of this stuff has ever stuck with me, and I inevitably end up googling for it once I actually need it.

You'll be okay, though. Just read your colleagues' code, ask questions here and on StackOverflow, and - whatever you do - don't try to plot anything.

Matt Parker
  • 5,597
  • 5
  • 26
  • 37
  • @Matt - I think `Proc SGPLOT` roxxx. – suncoolsu Mar 09 '11 at 02:33
  • @Matt Parker - I have not found a SAS general resource book I have found satisfactory. Do you have any suggestions or do you simply rely on internet searches? – Andy W Mar 09 '11 at 04:39
  • 1
    @Matt I found The Kleinman and Horton book pretty useful. And, like @suncoolsu I find the new SGPLOT, SGSCATTER and SGPANEL PROCS are much better than the old SAS graphics system. And SGRENDER allows a LOT of control over graphics. And the ODS graphics that come with each statistical PROC are very nice defaults. – Peter Flom Mar 09 '11 at 10:22
  • 2
    @Matt (+1) Nice response. I also came across this blog which provides illustrated examples of R/SAS: http://sas-and-r.blogspot.com/. – chl Mar 09 '11 at 10:37
  • Thanks for the pointers on those new procedures, @suncoolsu and @Peter - I've only recently been upgraded to 9.2, so I'll definitely check that out. Also, just to clarify: I don't think "SAS and R" is poorly done, it has just never really helped me when I was in need. @chl, the blog you found is actually the companion blog to this book, which is a really nice addition by the authors. – Matt Parker Mar 09 '11 at 16:10
  • @Andy, nor have I, but I haven't really looked. I can usually get what I need from searching. But that's for putting out fires - it doesn't do much to really build my skills as a SAS coder for the long run. Let me know if you find something good. – Matt Parker Mar 09 '11 at 16:14
  • Incidentally, I've also found that making snide comments about SAS and then being corrected by people who are more knowledgeable than me is also an effective method of learning about SAS, albeit a bit rough on the ego... – Matt Parker Mar 09 '11 at 16:22
6

A couple things to add to what @matt said:

In addition to SUGI (which is now renamed SAS Global Forum, and will be held this year in Las Vegas) there are numerous local and regional SAS user groups. These are smaller, more intimate, and (usually) a lot cheaper. Some local groups are even free. See here

SAS-L. This is a mailing list for SAS questions. It is quite friendly, and some of the participants are among the best SAS programmers there are.

The book SAS and R: Data Management, Statistical Analysis and Graphics by Kleinman and Horton. Look up what you want to do in the R index, and you'll find how to do it in SAS as well. Sort of like a inter-language dictionary.

Peter Flom
  • 94,055
  • 35
  • 143
  • 276
4

In addition to Matt Parkers excellent advice (particularly about reading colleagues code), the actual SAS documentation can be surprisingly helpful (once you've figured out the name of what you want): http://support.sas.com/documentation/

And the Global Forum/SUGI proceedings are available here: http://support.sas.com/events/sasglobalforum/previous/online.html

Simon Byrne
  • 3,336
  • 15
  • 29