SAS and R: Data Management, Statistical Analysis, and Graphics

Ken Kleinman and Nicholas J. Horton

Cover image

Second edition now available: click HERE for more information.

This book shows how equivalent statistical methods can be applied in either SAS or R, enabling users of each software package to learn how to apply the methods in the other. It covers data management, simple statistical procedures, modeling and regression, and graphics. Each section begins with a brief introduction to the procedures and then presents the code for each software side-by-side. The book provides detailed worked examples together with output from the software to illustrate how the methods are applied in practice. It also includes an index for both SAS and R, which will be useful to a wide range of users.

"As the authors point out in the Introduction, the book functions like an English-French dictionary. The material is organized by task. By looking up a particular task you wish to perform, R and SAS code are presented and briefly explained. ... If you use both SAS and R on a regular basis, get this book. If you know one of the packages and are learning the other, you may need more than this book, but get this book too." - Charles Heckler, Technometrics (2010).

"I am a long time SAS user who is surrounded by R experts. As such, I have been looking, for years, for a dictionary to translate between R and SAS. That is what this book is designed to do and it is absolutely excellent for this purpose. It covers all the SAS data manipulation and graphics procedures and functions that I use all the time and it shows how to do them in R. Happily the book is very up to date and the most modern (9.21) SAS graphics procedures (like sgplot) are covered. The organization and indexing are fantastic. There is a table of contents, an index with SAS vocabulary, an index of R vocabulary and an overall index. Using these tools you can quickly find the procedure/methods that you want to accomplish and get parallel code snippets in both languages along with annotation to say what the differences are between the two implementations. In addition to the pure dictionary organization there are extended examples working through the analysis and visualization of a large data set. This book is a must for people moving to R from SAS (or the other direction) and it should be excellent for people needing a dictionary to find functions/procedures to do data manipulation and graphic(s) tasks in either language." Amazon 5 star review

"For statisticians with knowledge of both SAS and R programming this book provides a useful resource to understand the differences between SAS and R codes and can be used for browsing and for finding particular SAS and R functions to perform common tasks. The book will strengthen the analytical abilities of relatively new users of either system by providing them with a concise reference manual and annotated examples executed in both packages. Professional analysts as well as statisticians, epidemiologists and others who are engaged in research or data analysis will find this book very useful. The book is comprehensive and covers an extensive list of statistical techniques from data management to graphics procedures, cross-referencing, indexing and good worked examples in SAS and R at the end of each chapter." - Significance (2010)

"... this book does exactly what it promises: it facilitates a translation between SAS and R, without getting overly detailed or technical. It is mainly useful as a starting point for those who already know either R or SAS, and want to learn the other language, without going over extensive manuals or introductory texts. " - Jeroen Ooms, Journal of Statistical Software (2011).

See our blog for additional entries.

Last updated July 28, 2014