R for SAS and SPSS Usersintroduces R using SAS and SPSS terms with which you are already familiar. It demonstrates which of the add-on packages are most like SAS and SPSS and compares them to R’s built-in functions. It steps through over 30 programs written in all three packages, comparing and contrasting the packages’ differing approaches. The programs and practice data sets are available for download.
The glossary defines over 50 R terms using SAS/SPSS jargon and again using R jargon. The table of contents and the index allow you to find equivalent R functions by looking up both SAS statements and SPSS commands. When finished, you will be able to import data, manage and transform it, create publication quality graphics, and perform basic statistical analyses.
Reviews and Comments from Readers
“This is a greatly expanded second edition of a text that has already proved widely popular…[it] is a wide ranging and carefully compiled source of information on R…a strongly recommended addition to the library of anyone who comes to R from SAS or SPSS.”
-International Statistical Review, 80, 1, 176-204,
by John H. Maindonald,
Author of Data Analysis and Graphics Using R: An Example-Based Approach
“As a long time SAS user this book makes the task of transition to R much more palatable and appealing. It also greatly reduces the time to get up and running in R effectively.”
-Technometrics, February 2011, Vol. 53, No. 1,
by Roger Sauter, PhD, CQE,
Math Modeler, Boeing Commercial Airplanes
“…I found the book extremely helpful. Over the last few months I am regularly reaching for the book from my bookshelf to find sensible R code and to help with some data manipulation. The material is laid out in a way that makes it very accessible. Because of this I recommend this book to any R user regardless of his or her familiarity with SAS or SPSS. For those dedicated SAS and SPSS users I especially recommend the book. As discussed in the Introduction section, the basics of the R language are very different from SAS and SPSS but this book’s layout, style, and content help with these differences. The ordering of the material is very user-friendly and sensible…
To new R users, and to R users of some years experience, I recommend this book. For new R users it will demystify many aspects, and for existing R users it will have many answers to those questions you have been too afraid to ask in public….”
-The American Statistician, February 2010, Vol. 64, No. 1,
by Jennifer Brown, PhD, Head,
Department of Mathematics and Statistics,
University of Canterbury
“The title of this book accurately describes its goal: to teach SAS and SPSS users how to use R…The book is laid out well, with sensible features such as a separate font for programs; tables listing complete programs in all three languages; an index with entries that include main SAS or SPSS commands and procedures, allowing users to locate R equivalents fairly quickly; and appendices comparing the three languages’ attributes and procedures/packages. It is much easier to read and likely comparably more helpful than a manual…There is no question in my mind that this can be a very useful book for its intended audience.”
-Biometrics, 65, 1313, December 2009
“I’m recommending your excellent book to many people.”
-Frank Harrell, PhD, Chair of the Department of Biostatistics,
Author of Hmisc, Design and rms Packages
“R for SAS and SPSS Users provides an excellent introduction to R. As Muenchen, Manager of the Statistical Computing Center at the University of Tennessee, notes in the Preface, the SPSS and SAS platforms, introduced over 30 years ago, have much in common – but are very different than 10 year old R. The book’s first chapters focus on gentle GUI’s for R before taking on the language starting in Chapter 8. At that point the book meticulously covers data management, data structures, programming, graphics and basic statistical analysis in R. The prose is clear, the examples tied to their SPSS and SAS analogs. The handling of both traditional and newer “ggplot2" graphics is comprehensive: SPSS and SAS users will undoubtedly find lots to like. The appendixes contrast R jargon with SPSS/SAS and compare SPSS/SAS products with the corresponding R packages.”
Information Management, June 15, 2010
“Fantastic guide for those who are very familiar with SAS and SPSS.”
-Michael Wexler, Author of The Net Takeaway
“Highly recommended…an excellent and unique reference”
-The Georgia R School
“Thank you for writing this book! I’ve been a SAS programmer for around 15 years, a SPSS programmer for around 4 years, and I also program in VBA, and coming to R from this background has been an exercise in frustration. R is just so different in how it handles data, and its command syntax, I found that having previous programming experience was not really an advantage. I was wondering about the value of this book as I already have the MASS book at home and The R Book, and it was the need to recode a lot of variables was the activity that made me purchase this book.
While other books give emphasis on how to do particular statistical and graphing techniques, they tend to omit details on how to import and manipulate variables and observations in order to undertake the statistical analysis. I find that data preparation is around 90% of my analysis time, so not having this information has a major effect on my productivity. This book covers all that missing detail, as well as some facets of statistical analysis as well. The chapters and sections are well laid out in a logical sequence, and the bonus for the kindle is being able to search for terms.
Robert Muenchen is a good writer as well: plain English explanations are given along with the code. He also gives examples of equivalent SAS and SPSS code so you can see the differences between them and R.
If you are coming to R from a SAS or SPSS background, even if you have other R reference material, I recommend you purchase this book.”
“If you are an experienced SAS or SPSS user, if you have committed to learning R, and if you find the initial steps perplexingly difficult despite all the R books you have bought, then R for SAS and SPSS Users, by Robert Muenchen, is the book for you. It fills a niche in between the simple R introductions (e.g. Dalgaard, Introductory Statistics with R), and complex R books (e.g. Pinheiro and Bates, Mixed-effects models in S and S-PLUS [very like R]; Ramsay and Silverman, Functional Data Analysis.) It has much overlap with Spector, Data Manipulation with R, but it puts the data manipulation in the context of data analysis tasks that you are trying to accomplish.
Starting at a low level of difficulty, the book shows how to install R, including installing the contributed packages **and their dependencies.** It shows how to run R programs in batch and in graphical user interfaces, how to use help, and it supplies some nice programs (on the book’s web page) to get started. By working a little each day, the reader can build skill and a library of programs. The book shows how to convert your (probably large and complex) SAS and SPSS data sets to R data structures for analysis. Assuming that you already deploy many skills and techniques when doing an analysis in SAS or SPSS, it explains how to do those tasks in R: how to select variables and cases using several techniques (by name, by logic, by subscripting from arrays); how to perform transformations on the variables; how to “restructure” data (convert variables to cases and cases to variables for different ways of analyzing what are repeated-measures data); how to sort a file; how to analyze a file BY a sort variable (SAS) or split variable (SPSS); how to add labels to variables; how to match-merge sorted files. For all of these tasks, there are small program files in triplicate, performing the exact same operation on the exact same data in R, in SAS, and in SPSS. The book describes how to use the intermediate and final computed values from an analysis in subsequent calculations; and how to find out what all the intermediate computed values are.
After that the author shows how to do many common graphical tasks: scatter plot matrices; titles, colors, legends; how to label points on graphs; add fitted lines with confidence bands, or confidence ellipses to scatterplots; rescale axes to logarithmic; and much more. After this solid foundation in data management (about 270 pp.) and graphing (100 pp.), the author presents elementary statistics: cross-tabulation, linear regression, Wilcoxon tests, and more.
If you are like me, you have found the transition to different data structure the hardest step, the step most like learning a new language. This book is great help in making that transition.
There are some things that this book is not. It is not about how to do complex data analyses in R; however, you will be able to master the books that explain those analyses after you have mastered this book (and you’ll probably be better able to make good use of Crawley, The R Book.) The basic text is about 450 pp., and it would have been an impossibly long book if it had tried to cover all important techniques. It is not a book on how to use SAS or SPSS if you are a master of R: it assumes fluency with SAS or SPSS from the start, and proficiency at data analysis in SAS or SPSS, but it introduces R at an elementary level and works slowly upward from there.
I recommend it highly”.
-Matthew Marler, PhD
“I’ve used and taught SAS and SPSS since about 1982. It seems to me that much of the new statistical developments are coming out in the open-source R language, rather than business-prediction software like SAS or SPSS. The number of new statistical packages in R is rapidly increasing, including packages supported by high quality textbooks. SAS and SPSS offer “business intelligence” — software to help businessmen predict the future — rather than cutting-edge tools for serious research.
There are many good books for R experts, and good beginners books are starting to come out. Before Muenchen’s book, there was nothing for the experienced SAS/SPSS programmer to learn R. Since R is object-oriented, it “thinks” quite differently from SAS and SPSS, and you spend as much time unlearning old approaches as learning new ones.
The author of R FOR SAS AND SPSS USERS knows how SAS/SPSS programmers think, since he is one of us and has spent decades at UT teaching people to manage and analyze data in SAS, SPSS, and other software. This makes his explanations seem intuitive and natural without the “one hand clapping” feeling you get from R “help” messages. The book is not only a good introduction but it goes into considerable detail to cover basic and intermediate R programming. The style is simple and lucid. Unlike some R material, the book is rich in concrete examples during exposition. Each chapter has 3 tables of similar code in SAS, SPSS, and R, which may help it serve as a “lookup book” during programming.
I keep the book’s examples open in my editor when I write R code so that I can cut and paste working code from the book rather than doing trial and error on minor details. This same cut-and-paste approach works with SAS, SPSS, and other software.
If you have some years with SAS or SPSS and you want to learn R, this will be your #1 book.”
Behavioral Statistics Coordinator,
Center for Evaluation and Program Improvement
“This book really is a superb reference for looking up how to do things in R. As an experienced SAS user – an ordinary guy using statistics for work, not a statistician – who recently branched out, I found that R’s very different mindset made for a formidable learning curve. My discovery of this book flattened the learning curve dramatically and has saved me dozens of hours. I found the book to be a far more accessible treatment of R than other resources and I have little doubt that those coming to R from backgrounds other than SAS or SPSS will similarly find it valuable. Although it is worth reading the book cover to cover, sections are structured so that it is easy to jump in wherever some help is needed. The table of contents effectively points the way to major topics and the index is implemented well. Explanations are clear and examples are abundant: Muenchen generally shows multiple ways to accomplish the same or similar tasks. These varied approaches not only help cement understanding of how R works, but give the reader an abundance of models from which to work.”
“This book is absolutely excellent. The focus is on the data manipulation and processing that goes on before analysis. As a longtime SAS user, this is the major stumbling block for me using R. The parallels and discrepancies across the languages are clearly pointed out with solid code examples. The book covers basic syntax but more importantly it goes way beyond saying this is the syntax for an “if” statement in SAS and this is an “if” statement in R. The author goes into the important fundamental differences in how the two languages think about and process data.There is also very good coverage of R graphics (especially the set of functions in ggplot2 that are wildly useful and rarely mentioned in other books). The coverage of statistics is limited to only one chapter. So, do not get the book if you only want to learn the ins-and-outs of R stats. Happily that chapter covers the most commonly done statistics. So even in its short presentation it should help everyone.
While the book is geared toward someone with experience in SAS or SPSS, I think it would be excellent for anyone learning R. The links to the point and click versions of R (R commander, Rattle or JGR) are invaluable for anyone starting out.
The author is actively maintaining the book’s website. So be sure to grab the errata and his notes.”
-Raymond Balise, PhD, Stanford University
“I wanted to write this book, but Robert Muenchen did a much better job!”
-Georgette Asherman, founder, Direct Effects
“Honorable Mention: Best R Book for existing SAS/SPSS users.
This is an excellent book on doing statistics with R – even if you are not an experienced user of SPSS or SAS. But if you ARE an SPSS or SAS user, this book will really excite you – it puts everything in R in a familiar context, and will help you get going with R much faster than any other book we have seen.”
“So you decided to cut down on your statistical software expenses and decided to get R, but the problem is you know SAS/SPSS and you need to learn R fast enough to justify switching over. The ideal book for you is R for SAS and SPSS Users. …It’s a really easy book, you have the SAS Syntax, the corresponding SPSS Syntax and the R Syntax.”
– Ajay Ohri, Author of DecisionStats
and R for Business Analytics
“One of the most clearly written, well designed, books I’ve read on a programming language (of any variety or type) in my career. And as a computer scientist, I’ve read quite a few! You seem to have a knack for guessing ahead of time what problems R users will potentially have and explaining to the reader, without talking down, how to get around the problem.”
– Andreas Stefik, PhD
Central Washington University
Department of Computer Science
“I’ve used SAS for 16 years and have found the transition to R to be fairly difficult. This book has helped a lot. It’s well organized and I’ve found myself turning to it as a go to source for how to get things done. The online documentation for R is probably its weakest characteristic and you need a book like this. In all other respects I have found the book quite useful and would buy additional books by the author if they were available.”
-David Young, Director at Crisbal Company Limited
“In order to learn R quickly, I would suggest the following sequence: read An Introduction to R, followed by R for SAS and SPSS Users”.
– Robert I. Kobakoff, Ph.D., Author of the web site
Quick-R for SAS/SPSS/Stata Users
(Now that Rob has his own excellent R book out,
I expect he has a different view!)
“I think the hands down best intro for R (and I have the Dalgaard and Gelman and Hill books) is R for SAS and SPSS Users. The thing that sells this one is that most people who want to get into R are already users of either SAS or SPSS. What Muenchen does is to track what you would normally do in those apps with how to do the same thing in R. That means he has to explain why R does things (often perversely) the way it does and he guides you to packages in R that replicate SAS and SPSS routines very closely.”
-Tracy Lightcap, PhD, Professor and Chair, Department of Political Science, LaGrange College
“This is a really great book. It is easy to read, quite comprehensive, and would be extremely valuable to both regular R users and users of SAS and SPSS who wish to switch to or learn about R…An invaluable reference.”
– David Hitchcock, Assistant Professor, Department of Statistics, University of South Carolina
“With the integration of R and SPSS beginning with version 16 via the R Plug-In, this is a timely book for SPSS users…This book does a great job of leveraging prior knowledge of SPSS (or SAS) to get users started in making the best use of R. R documentation tends to be written by experts and for experts. This book is written by an expert for beginners.”
– Jon Peck, Technical Advisor and Principal Software Engineer, SPSS Inc.
“As his title suggests, Robert Muenchen crafted this to be a Rosetta Stone for SAS and SPSS users to start learning R quickly and effectively. Has he achieved this? Yes, and more.”
– Ralph O’Brien, Case Western Reserve University, ASA Fellow
“If you are coming to R from a SAS or SPSS background then R for SAS and SPSS Users is a good choice. Even if you are not a SAS or SPSS user the book provides a straightforward introduction to using R.”
-Graham Williams, Developer of the Rattle data mining user interface for R
“R for SAS and SPSS Users is a sight for sore eyes for anyone in the statistical analysis community. Bob manages to take a genuinely complex topic (e.g., programming in R), and transform it into something manageable to learn.” (5-star rating)
-Andreas, reviewer at Goodreads
“I am a statistician working at GlaxoSmithKline. As a long-time SAS user, I really enjoyed reading your book, R fro SAS and SPSS Users, and I am sure I will read it again and again when I have questions. I read some free online books/articles on R before reading your book, and most of them were difficult to understand. After reading your book, I use R with confidence. Thank you very much for writing this great book.”
Chun Huang, PhD
“R users with analytic backgrounds and experience with software packages such as SAS and SPSS will do well to start with Muenchen’s R for SPSS and SAS users…”
“Thanks for writing R for SAS and SPSS Users – it is a comprehensible and clever document. The graphics chapter is superb!”
– Tony N. Brown, Associate Professor,
Department of Sociology, Vanderbilt University
“I am a professional SAS and SPSS programmer and found this book extremely useful.”
– Tony Chu, Public Policy
Research Data Analyst
“I have used SAS for 15 years in my ecology research and have decided to move to R…thanks so much for writing your book – I have been banging my head against a wall, despite a number of other books, trying to figure out how to think in R and how it differs from SAS – your book has been a fantastic help. I love the way you give the code and terminology for both so I can see how to translate.”
– Clare McArthur, University of Sydney
“It is very lucid, pitched at the right level, and aims for a workflow that I’m familiar with.”
“Thanks for writing the document, “R for SAS and SPSS Users”…it’s fantastic and I really appreciate it.”
-Madan Gopal Kundu, Biostatistician,
CDM, MACR, Ranbaxy Labs, Ltd.
“I like your book so much. I used it the reverse way. I learned a little SAS.”
-Manos Parzakonis, author of Stats Raving Mad
“The chapters on graphics are good introductions, with many examples, of two approaches to graphics in R.”
-Joseph G. Voelkel, International Statistical Review
(2009), 77, 3, 465-466
“Officially this is my third attempt to learn R and I must say things are looking up this time…I am using the R for SAS and SPSS Users book as my bible and now…I’d recommend this book to anybody wanting to learn R, even for those of you who don’t know SAS or SPSS as the explanations are very clear…”
-A Pint of R
“Muenchen thinks deeply about what is useful…he knows what he is talking about!”
– Wolfgang Härdle, Humboldt-Universität zu Berlin,
author of Applied Multivariate Statistical Analysis
and several other books