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

Free Standard Shipping

Purchasing Options

eBook (VitalSource)
ISBN 9781420070590
Cat# CE7057



SAVE 30%

eBook Rentals

Other eBook Options:


CRC Press Authors Speak: Nick Horton

  • Presents a broad set of data management, analysis, and graphical tasks in SAS and R
  • Provides parallel examples in SAS and R to demonstrate how to use the software and derive identical answers regardless of software choice
  • Gives insight into the process of statistical coding from beginning to end by supplying worked examples of complex coding tasks
  • Contains gentle introductions to complex issues and stumbling blocks new users encounter
  • Covers the ODS and new graphics of SAS 9.2
  • Includes an index for each software, allowing users to easily locate procedures
  • Offers the SAS and R data sets and code available online


An All-in-One Resource for Using SAS and R to Carry out Common Tasks

Provides a path between languages that is easier than reading complete documentation
SAS and R: Data Management, Statistical Analysis, and Graphics presents an easy way to learn how to perform an analytical task in both SAS and R, without having to navigate through the extensive, idiosyncratic, and sometimes unwieldy software documentation. The book covers many common tasks, such as data management, descriptive summaries, inferential procedures, regression analysis, and the creation of graphics, along with more complex applications.

Takes an innovative, easy-to-understand, dictionary-like approach
Through the extensive indexing, cross-referencing, and worked examples in this text, users can directly find and implement the material they need. The book enables easier mobility between the two systems: SAS users can look up tasks in the SAS index and then find the associated R code while R users can benefit from the R index in a similar manner. Demonstrating the code in action and facilitating exploration, the authors present extensive example analyses that employ a single data set from the HELP study. They offer the data sets and code for download on the book’s website.

Table of Contents

Data Management



Structure and Meta-Data

Derived Variables and Data Manipulation

Merging, Combining, and Subsetting Data Sets

Date and Time Variables

Interactions with the Operating System

Mathematical Functions

Matrix Operations

Probability Distributions and Random Number Generation

Control Flow, Programming, and Data Generation

Common Statistical Procedures

Summary Statistics

Bivariate Statistics

Contingency Tables

Two Sample Tests for Continuous Variables

Linear Regression and ANOVA

Model Fitting

Model Comparison and Selection

Tests, Contrasts, and Linear Functions of Parameters

Model Diagnostics

Model Parameters and Results

Regression Generalizations

Generalized Linear Models

Models for Correlated Data

Survival Analysis

Further Generalizations to Regression Models


A Compendium of Useful Plots

Adding Elements

Options and Parameters

Saving Graphs

Other Topics and Extended Examples

Power and Sample Size Calculations

Generate Data from Generalized Linear Random Effects Model

Generate Correlated Binary Data

Read Variable Format Files and Plot Maps

Missing Data: Multiple Imputation

Bayesian Poisson Regression

Multivariate Statistics and Discriminant Procedures

Complex Survey Design

Appendix A: Introduction to SAS


Running SAS and a Sample Session

Learning SAS and Getting Help

Fundamental Structures: Data Step, Procedures, and Global Statements

Work Process: The Cognitive Style of SAS

Useful SAS Background

Accessing and Controlling SAS Output: The Output Delivery System

The SAS Macro Facility: Writing Functions and Passing Values


Appendix B: Introduction to R


Running R and Sample Session

Learning R and Getting Help

Fundamental Structures: Objects, Classes, and Related Concepts

Built-in and User-Defined Functions

Add-ons: Libraries and Packages

Support and Bugs

Appendix C: The HELP Study Data Set

Background on the HELP Study

Roadmap to Analyses of the HELP Data Set

Detailed Description of the Data Set

Appendix D: References

Appendix E: Indices

Subject Index

SAS Index

R Index

Further Resources and HELP Examples appear at the end of each chapter.

Author Bio(s)

Ken Kleinman is an associate professor at Harvard Medical School. His research deals with clustered data analysis, surveillance, and epidemiological applications.

Nicholas J. Horton is an associate professor of statistics at Smith College. His research interests include longitudinal regression models and missing data methods.

Editorial Reviews

"By placing the R and SAS solutions together and by covering a vast array of tasks in one book, Kleinman and Horton have added surprising value and searchability to the information in their book. … a home run, and it is a book I am grateful to have sitting, dust-free, on my shelf."
—Robert Alan Greevy, Jr, Teaching of Statistics in the Health Sciences, Spring 2013

"Excellent cross-referencing to other topics and end-of-chapter worked examples on the ‘Health evaluation and linkage to primary care’ data set are given with each topic. … users who are proficient in either of the software packages but with the need to use the other will find this book useful."
—Frances Denny, Journal of the Royal Statistical Society, Series A, 2012

"This book provides a very useful bridge between the two packages … . A wide range of procedures are covered and the code, which is generally well explained, is available for download from their website. … this is a very useful book for SAS and R users alike with an excellent overview of a wide range of data management options, statistical analyses and graphics. … full of useful tips and tricks."
—Robin Turner, Statistics in Medicine, 2012

"It is clearly written and code is appropriately highlighted to facilitate readability. … it is a potentially useful reference material for experienced users of one of the two systems, who need to quickly find how to perform a familiar task in the alternative system."
Biometrics, 67, September 2011

"It is an excellent text that is designed to translate SAS to R. … 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, July 2011

"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. … It is easy to find the section in the text which gives several ways to do this in both SAS and R. … Because the authors often present alternative ways to do a task, this book can be a great source of diverse and elegant solutions even to experienced users. Each task is cross-referenced to other tasks. … The book has a comprehensive website containing the code, datasets, a FAQ, blog, and errata list with a link to report new errors. … The end of the book is very useful, where there are good introductions to SAS and R, as well as separate subject, SAS, and R indices. These indices are invaluable for finding a topic when you are unsure of exactly how to phrase it. … there is great breadth and scope of the material in this book. … 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 … get this book, too."
—Charles E. Heckler, Technometrics, May 2011

"… a convenient reference text to quickly learn by example how to perform common tasks in both software packages. … the book provides a powerful starting point to a wide variety of statistical techniques available in SAS and R. … 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."
Journal of Statistical Software, January 2011, Volume 37

Downloads / Updates

Resource OS Platform Updated Description Instructions
Cross Platform June 12, 2009 The webpage includes datasets, code and sample material from the book click on