Lora D. Delwiche

Exercises and Projects for The Little SAS Book, Sixth Edition


Скачать книгу

      Lottery

      Loan Strategies

      Twitter Data

      World Bank

      Toxic Chemicals

      Selected Solutions

      Chapter 1—Getting Started Using SAS Software

      Chapter 2—Accessing Your Data

      Chapter 3—Working with Your Data

      Chapter 4—Sorting, Printing, and Summarizing Your Data

      Chapter 5—Enhancing Your Output with ODS

      Chapter 6—Modifying and Combining SAS Data Sets

      Chapter 7—Writing Flexible Code with the SAS Macro Facility

      Chapter 8—Visualizing Your Data

      Chapter 9—Using Basic Statistical Procedures

      Chapter 10—Exporting Your Data

      Chapter 11—Debugging Your SAS Programs

      About This Book

      Who should use this book This book was written for anyone who wants hands-on experience while learning or practicing the basics of SAS programming. The exercises and projects in this book are designed so that they can be used in a classroom setting or by an individual reader working alone.

      Content This book consists of exercises (with selected solutions) and projects. Each chapter in this book covers the same material as the corresponding chapter in The Little SAS Book, Sixth Edition. The content in each chapter builds on previous chapters, so we do not expect a reader to use a technique in one chapter that is introduced in a later chapter.

      Exercises There are three types of exercises in this book: multiple choice, short answer, and programming. Each type of exercise is designed to improve the comprehension of topics and syntax, and to develop SAS coding skills with realistic data sets.

      Solutions Solutions are provided for odd-numbered multiple choice and short answer questions. Solutions are not provided for programming exercises, but hints are provided to help give readers direction.

      Projects The projects in the final chapter are designed to serve as a comprehensive capstone for the programming skills developed throughout the book. Each project gives readers a chance to synthesize the material learned from various chapters. Completing a project will take several days of intense thought and coding, and will result in a final product that could serve as evidence of SAS proficiency to a future employer or course instructor. Projects can be completed by a group or an individual.

      Typographical Conventions This book uses the same typographical conventions as The Little SAS Book. SAS doesn’t care whether your programs are written in uppercase or lowercase, so you can write your programs any way you want. In this book, we have used uppercase and lowercase to tell you something. All SAS keywords appear in uppercase letters. A keyword is an instruction to SAS and must be spelled correctly. Anything that programmers make up such as variable names, names for SAS data sets, comments, or titles are generally shown in lowercase or mixed-case letters.

      Data Sets We have tried to include programming exercises with data sets that are somewhat large, unruly, and messy. We hope that this will help our readers develop their skills more fully. Some of the exercises are based on data that come directly from public sources, while others have been designed to mimic real-life scenarios.

      The data sets for exercises can be accessed via web pages for any of the authors of this book at the support site for SAS, support.sas.com/publishing/authors (select the name of the author; then, look for the cover thumbnail of this book and select Exercise Data). The data sets are organized by chapter, and they are also available in a single, downloadable ZIP file. If you are unable to access the data through the website, send an email to [email protected].

      The projects in the final chapter use real data. We give instructions for locating and downloading the data from primary sources so that you will have the most up-to-date and authentic data possible.

      How to use this book The exercises are organized in such a way as to help readers develop useful and sensible programming habits. Readers are encouraged to examine all raw data files and SAS data sets they will be accessing before writing any code.

      In many of the programming exercises, we do not explicitly ask the reader to use a particular function or procedure. This was intentional in order to provide users with the opportunity to develop code based on what they learned from the topics that are covered in the corresponding chapter. This means that the code written by one person may not be the same as that written by another person, even though they both may arrive at the same answer.

      While the material presented in the book includes exercises for certain graphical and statistical analyses, the purpose of these chapters is merely to introduce the basic syntax and concepts, and not the fine details of the analysis itself. This book may be used in a statistics course as a programming supplement. However, it should not be considered a statistical textbook.

      Compatibility with SAS software This book was developed using SAS 9.4, but the exercises are compatible with SAS 9.3 and later. Most exercises require only Base SAS, but a few in Chapter 9 require SAS/STAT, and a few in Chapters 2 and 10 require SAS/ACCESS Interface to PC Files. The exercises in this book were designed to be programmed in the SAS windowing environment, SAS Enterprise Guide, SAS Studio, SAS OnDemand for Academics, or the SAS University Edition through SAS Analytics U. We have noted the few instances when an exercise is specific to the SAS windowing environment. Otherwise, the exercise can be considered environment-independent. Path references in this book are, however, specific to Microsoft Windows, and may need to be adjusted for other environments such as UNIX, Linux, or z/OS. (SAS University Edition runs in a Linux environment even if you are using a Windows PC.)

      For Instructors Instructors may obtain a complete solutions manual by completing the form found at the “Instructors Solutions” link on the web pages for any of the authors at support.sas.com/publishing/authors, and providing the appropriate credentials. The solutions given for the programming exercises are not the only ones possible. Many of the exercises can be solved in multiple ways. Instructors may choose to share a snippet of output or a graph if they think their students need a little extra help to complete an exercise. The section references that accompany the instructors’ solutions refer to the sections in The Little SAS Book, Sixth Edition where the material is covered. These references are listed only for the corresponding chapter of the exercise even though the answer may use subject matter from a previous chapter.

      We encourage instructors to add their own follow-up questions to any of the exercises for class assignments. In Chapter 9, “Using Basic Statistical Procedures,” we have supplied many extra variables in the data sets so that instructors can append additional questions according to the content covered in their course.

      For the projects in the final chapter, instructors may choose to download and distribute the data for the class to use. Instructors may clean the data for the class as they see fit, or leave the data manipulation to the students instead.

      Additional Help Although this book illustrates many programming tasks and analyses regularly performed in businesses across industries, questions specific to your aims and issues may arise. To fully support you, SAS Institute and SAS Press offer you the following resources:

      • For questions about topics covered in this book, contact the authors through SAS Press at [email protected].

      • For questions about topics in or beyond the scope of this book, post queries to the relevant SAS Support Communities at communities.sas.com.

      • To search the SAS user Knowledge Base or contact SAS Customer Support you can visit