100% found this document useful (3 votes)
92 views65 pages

Step by Step Programming with Base SAS 9 4 Second Edition Sas Institute 2024 scribd download

Programming

Uploaded by

acitosmabyqa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
92 views65 pages

Step by Step Programming with Base SAS 9 4 Second Edition Sas Institute 2024 scribd download

Programming

Uploaded by

acitosmabyqa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

Download the Full Version of textbook for Fast Typing at textbookfull.

com

Step by Step Programming with Base SAS 9 4 Second


Edition Sas Institute

https://textbookfull.com/product/step-by-step-programming-
with-base-sas-9-4-second-edition-sas-institute/

OR CLICK BUTTON

DOWNLOAD NOW

Download More textbook Instantly Today - Get Yours Now at textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

SAS Certification Prep Guide Base Programming for SAS 9


4th Edition Sas Institute

https://textbookfull.com/product/sas-certification-prep-guide-base-
programming-for-sas-9-4th-edition-sas-institute/

textboxfull.com

SAS Certified Specialist Prep Guide Base Programming Using


SAS 9 4 Sas

https://textbookfull.com/product/sas-certified-specialist-prep-guide-
base-programming-using-sas-9-4-sas/

textboxfull.com

SAS certification prep guide base programming for SAS 9


Fifth Edition. Edition Sas Sas Sas

https://textbookfull.com/product/sas-certification-prep-guide-base-
programming-for-sas-9-fifth-edition-edition-sas-sas-sas/

textboxfull.com

Python Programming A Step By Step Guide From Beginner To


Advance Second Edition Eddison

https://textbookfull.com/product/python-programming-a-step-by-step-
guide-from-beginner-to-advance-second-edition-eddison/

textboxfull.com
Learn to Program with Python 3: A Step-by-Step Guide to
Programming Irv Kalb

https://textbookfull.com/product/learn-to-program-with-
python-3-a-step-by-step-guide-to-programming-irv-kalb/

textboxfull.com

Learn to Program with Python 3: A Step-by-Step Guide to


Programming, 2nd Edition Irv Kalb

https://textbookfull.com/product/learn-to-program-with-
python-3-a-step-by-step-guide-to-programming-2nd-edition-irv-kalb/

textboxfull.com

ANSI C Programming Learn ANSI C Step by Step 1st Edition


Yashavant Kanetkar

https://textbookfull.com/product/ansi-c-programming-learn-ansi-c-step-
by-step-1st-edition-yashavant-kanetkar/

textboxfull.com

Serial Attached SCSI 4 SAS 4 r10b 6777

https://textbookfull.com/product/serial-attached-
scsi-4-sas-4-r10b-6777/

textboxfull.com

Visual Basic For Kids A Step by Step Computer Programming


Tutorial Philip Conrod

https://textbookfull.com/product/visual-basic-for-kids-a-step-by-step-
computer-programming-tutorial-philip-conrod/

textboxfull.com
Step-by-Step Programming with
Base SAS 9.4 ®

Second Edition

SAS Documentation
®
The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2016. Step-by-Step Programming
with Base SAS® 9.4, Second Edition. Cary, NC: SAS Institute Inc.
Step-by-Step Programming with Base SAS® 9.4, Second Edition
Copyright © 2016, SAS Institute Inc., Cary, NC, USA
ISBN 978-1-62959-894-9 (Hard copy)
ISBN 978-1-62960-806-8 (PDF)
All Rights Reserved. Produced in the United States of America.
For a hard-copy book: No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in
any form or by any means, electronic, mechanical, photocopying, or otherwise, without the prior written permission
of the publisher, SAS Institute Inc.
For a web download or e-book: Your use of this publication shall be governed by the terms established by the
vendor at the time you acquire this publication.
The scanning, uploading, and distribution of this book via the Internet or any other means without the permission of
the publisher is illegal and punishable by law. Please purchase only authorized electronic editions and do not
participate in or encourage electronic piracy of copyrighted materials. Your support of others’ rights is appreciated.
U.S. Government License Rights; Restricted Rights: The Software and its documentation is commercial computer
software developed at private expense and is provided with RESTRICTED RIGHTS to the United States
Government. Use, duplication, or disclosure of the Software by the United States Government is subject
to the license terms of this Agreement pursuant to, as applicable, FAR 12.212, DFAR 227.7202-1(a), DFAR
227.7202-3(a), and DFAR 227.7202-4, and, to the extent required under U.S. federal law, the minimum restricted
rights as set out in FAR 52.227-19 (DEC 2007). If FAR 52.227-19 is applicable, this provision serves as notice under
clause (c) thereof and no other notice is required to be affixed to the Software or documentation. The Government’s
rights in Software and documentation shall be only those set forth in this Agreement.
SAS Institute Inc., SAS Campus Drive, Cary, NC 27513-2414
November 2016
SAS® and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS
Institute Inc. in the USA and other countries. ® indicates USA registration.
Other brand and product names are trademarks of their respective companies.
SAS software may be provided with certain third-party software, including but not limited to open-source software,
which is licensed under its applicable third-party software license agreement. For license information about third-
party software distributed with SAS software, refer to http://support.sas.com/thirdpartylicenses.
9.4-P2:basess
Contents

About This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii


What’s New in Step-by-Step Programming with Base SAS 9.4 . . . . . . . . . . . . . . . . . . . xix
Accessibility Features of Step-by-Step Programming with Base SAS 9.4 . . . . . . . . . . . xxi

PART 1 Introduction to the SAS System 1

Chapter 1 • What is the SAS System? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3


Introduction to the SAS System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Components of Base SAS Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Output Produced by the SAS System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Ways to Run SAS Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Running Programs in the SAS Windowing Environment . . . . . . . . . . . . . . . . . . . . . . . 13
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

Chapter 2 • Working with Output Defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17


Working with Output Defaults Starting in SAS 9.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

PART 2 Getting Your Data into Shape 25

Chapter 3 • Introduction to DATA Step Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27


Introduction to DATA Step Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
The SAS Data Set: Your Key to the SAS System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
How the DATA Step Works: A Basic Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Supplying Information to Create a SAS Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

Chapter 4 • Starting with Raw Data: The Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51


Introduction to Raw Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Examine the Structure of the Raw Data: Factors to Consider . . . . . . . . . . . . . . . . . . . . 52
Reading Unaligned Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Reading Data That Is Aligned in Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Reading Data That Requires Special Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Reading Unaligned Data with More Flexibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Mixing Styles of Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

Chapter 5 • Starting with Raw Data: Beyond the Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71


Introduction to Beyond the Basics with Raw Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Testing a Condition Before Creating an Observation . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Creating Multiple Observations from a Single Record . . . . . . . . . . . . . . . . . . . . . . . . . 73
Reading Multiple Records to Create a Single Observation . . . . . . . . . . . . . . . . . . . . . . 77
iv Contents

Problem Solving: When an Input Record Unexpectedly Does Not


Have Enough Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

Chapter 6 • Starting with SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91


Introduction to Starting with SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Understanding the Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Input SAS Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Reading Selected Observations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Reading Selected Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Creating More Than One Data Set in a Single DATA Step . . . . . . . . . . . . . . . . . . . . . . 99
Using the DROP= and KEEP= Data Set Options for Efficiency . . . . . . . . . . . . . . . . . 101
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

PART 3 Basic Programming 105

Chapter 7 • Understanding DATA Step Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107


Overview of DATA Step Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Input SAS Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Adding Information to a SAS Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Defining Enough Storage Space for Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Conditionally Deleting an Observation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

Chapter 8 • Working with Numeric Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117


Introduction to Working with Numeric Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
About Numeric Variables in SAS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Input SAS Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Calculating with Numeric Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Comparing Numeric Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Storing Numeric Variables Efficiently . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

Chapter 9 • Working with Character Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129


Introduction to Working with Character Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Input SAS Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Identifying Character Variables and Expressing Character Values . . . . . . . . . . . . . . . 131
Setting the Length of Character Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Handling Missing Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Creating New Character Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Saving Storage Space by Treating Numbers as Characters . . . . . . . . . . . . . . . . . . . . . 142
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

Chapter 10 • Acting on Selected Observations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147


Introduction to Acting on Selected Observations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Input SAS Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Selecting Observations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Constructing Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Comparing Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Contents v

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

Chapter 11 • Creating Subsets of Observations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169


Introduction to Creating Subsets of Observations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Input SAS Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Selecting Observations for a New SAS Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Conditionally Writing Observations to One or More SAS Data Sets . . . . . . . . . . . . . . 175
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181

Chapter 12 • Working with Grouped or Sorted Observations . . . . . . . . . . . . . . . . . . . . . . . . . . 183


Introduction to Working with Grouped or Sorted Observations . . . . . . . . . . . . . . . . . . 183
Input SAS Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Working with Grouped Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Working with Sorted Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197

Chapter 13 • Using More Than One Observation in a Calculation . . . . . . . . . . . . . . . . . . . . . . . 199


Introduction to Using More Than One Observation in a Calculation . . . . . . . . . . . . . 199
Input File and SAS Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Accumulating a Total for an Entire Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Obtaining a Total for Each BY Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Writing to Separate Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Using a Value in a Later Observation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

Chapter 14 • Finding Shortcuts in Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215


Introduction to Shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Input File and SAS Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Performing More Than One Action in an IF-THEN Statement . . . . . . . . . . . . . . . . . . 217
Performing the Same Action for a Series of Variables . . . . . . . . . . . . . . . . . . . . . . . . . 219
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

Chapter 15 • Working with Dates in the SAS System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225


Introduction to Working with Dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Understanding How SAS Handles Dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Input File and SAS Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
Entering Dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
Displaying Dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Using Dates in Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Using SAS Date Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Comparing Durations and SAS Date Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244

PART 4 Combining SAS Data Sets 247

Chapter 16 • Methods of Combining SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249


Introduction to Combining SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Definition of Concatenating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
vi Contents

Definition of Interleaving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250


Definition of Merging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Definition of Updating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Definition of Modifying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Comparing Modifying, Merging, and Updating Data Sets . . . . . . . . . . . . . . . . . . . . . . 254
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255

Chapter 17 • Concatenating SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257


Introduction to Concatenating SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Concatenating Data Sets with the SET Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Concatenating Data Sets By Using the APPEND Procedure . . . . . . . . . . . . . . . . . . . . 274
Choosing between the SET Statement and the APPEND Procedure . . . . . . . . . . . . . . 278
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280

Chapter 18 • Interleaving SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281


Introduction to Interleaving SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Understanding BY-Group Processing Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Interleaving Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287

Chapter 19 • Merging SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289


Introduction to Merging SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Understanding the MERGE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
One-to-One Merging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Match-Merging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Choosing between One-to-One Merging and Match-Merging . . . . . . . . . . . . . . . . . . . 310
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315

Chapter 20 • Updating SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317


Introduction to Updating SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Understanding the UPDATE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
Understanding How to Select BY Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
Updating a Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
Updating with Incremental Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
Understanding the Differences between Updating and Merging . . . . . . . . . . . . . . . . . 326
Handling Missing Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333

Chapter 21 • Modifying SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335


Introduction to Modifying SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Input SAS Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Modifying a SAS Data Set: The Simplest Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
Modifying a Master Data Set with Observations from a Transaction Data Set . . . . . . 338
Understanding How Duplicate BY Variables Affect File Update . . . . . . . . . . . . . . . . 343
Handling Missing Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348

Chapter 22 • Conditionally Processing Observations from Multiple SAS Data Sets . . . . . . . . 349
Introduction to Conditional Processing from Multiple SAS Data Sets . . . . . . . . . . . . 349
Input SAS Data Sets for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
Determining Which Data Set Contributed the Observation . . . . . . . . . . . . . . . . . . . . . 353
Contents vii

Combining Selected Observations from Multiple Data Sets . . . . . . . . . . . . . . . . . . . . 358


Performing a Calculation Based on the Last Observation . . . . . . . . . . . . . . . . . . . . . . 359
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362

PART 5 Debugging SAS Programs 363

Chapter 23 • Analyzing Your SAS Session with the SAS Log . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Introduction to Analyzing Your SAS Session with the SAS Log . . . . . . . . . . . . . . . . . 366
Understanding the SAS Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
Locating the SAS Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Understanding the Log Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Writing to the SAS Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Suppressing Information in the SAS Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
Changing the Appearance of the Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388

Chapter 24 • Directing SAS Output and the SAS Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391


Introduction to Directing SAS Output and the SAS Log . . . . . . . . . . . . . . . . . . . . . . . 391
Input File and SAS Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
Routing the Output and the SAS Log with PROC PRINTTO . . . . . . . . . . . . . . . . . . . 393
Storing the Output and the SAS Log in the SAS Windowing Environment . . . . . . . . 395
Redefining the Default Destination in a Batch or Noninteractive Environment . . . . . 396
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398

Chapter 25 • Diagnosing and Avoiding Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399


Introduction to Diagnosing and Avoiding Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
Understanding How the SAS Supervisor Checks a Job . . . . . . . . . . . . . . . . . . . . . . . . 400
Understanding How SAS Processes Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
Distinguishing Types of Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
Diagnosing Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
Using a Quality Control Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412

Chapter 26 • Finding Logic Errors in Your Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415


Finding Logic Errors in Your Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Using the DATA Step Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
Basic Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
Using the Macro Facility with the Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419

PART 6 Producing Reports 431

Chapter 27 • Producing Detail Reports with the PRINT Procedure . . . . . . . . . . . . . . . . . . . . . . 433


Introduction to Producing Reports with the PRINT Procedure . . . . . . . . . . . . . . . . . . 434
Input File and SAS Data Sets for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
Creating Simple Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
Creating Enhanced Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
Creating Customized Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458
viii Contents

Making Your Reports Easy to Change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465


Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472

Chapter 28 • Creating Summary Tables with the TABULATE Procedure . . . . . . . . . . . . . . . . . 473


Introduction to Creating Summary Tables with the TABULATE Procedure . . . . . . . . 474
Understanding Summary Table Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
Understanding the Basics of the TABULATE Procedure . . . . . . . . . . . . . . . . . . . . . . . 476
Input File and SAS Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
Creating Simple Summary Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
Creating More Sophisticated Summary Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499

Chapter 29 • Creating Detail and Summary Reports with the REPORT Procedure . . . . . . . . . 501
Introduction to Creating Detail and Summary Reports with the REPORT Procedure . 501
Understanding How to Construct a Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502
Input File and SAS Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504
Creating Simple Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
Creating More Sophisticated Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527

PART 7 Producing Plots and Charts 529

Chapter 30 • Plotting the Relationship between Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531


Introduction to Plotting the Relationship between Variables . . . . . . . . . . . . . . . . . . . . 531
Input File and SAS Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532
Plotting One Set of Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
Enhancing the Plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537
Plotting Multiple Sets of Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549

Chapter 31 • Producing Charts to Summarize Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551


Introduction to Producing Charts to Summarize Variables . . . . . . . . . . . . . . . . . . . . . 552
Understanding the Charting Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552
Input File and SAS Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553
Charting Frequencies with the CHART Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . 555
Customizing Frequency Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
Creating High-Resolution Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590

PART 8 Designing Your Own Output 593

Chapter 32 • Writing Lines to the SAS Log or to an Output File . . . . . . . . . . . . . . . . . . . . . . . . 595


Introduction to Writing Lines to the SAS Log or to an Output File . . . . . . . . . . . . . . . 595
Understanding the PUT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596
Writing Output without Creating a Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596
Writing Simple Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597
Contents ix

Writing a Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603


Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611

Chapter 33 • Understanding and Customizing SAS Output: The Basics . . . . . . . . . . . . . . . . . 613


Introduction to the Basics of Understanding and Customizing SAS Output . . . . . . . . 614
Understanding Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614
Input SAS Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616
Locating Procedure Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617
Making Output Informative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 618
Controlling Output Appearance of Listing Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624
Controlling the Appearance of Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627
Representing Missing Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 642

Chapter 34 • Understanding and Customizing SAS Output: The Output


Delivery System (ODS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643
Introduction to Customizing SAS Output By Using the Output Delivery System . . . . 644
Input Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644
Understanding ODS Output Formats and Destinations . . . . . . . . . . . . . . . . . . . . . . . . 645
Selecting an Output Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647
Creating Formatted Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 648
Selecting the Output That You Want to Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661
Customizing ODS Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667
Storing Links to ODS Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683

PART 9 Storing and Managing Data in SAS Files 685

Chapter 35 • Understanding SAS Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687


Introduction to Understanding SAS Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687
What Is a SAS Library? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688
Accessing a SAS Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688
Storing Files in a SAS Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690
Referencing SAS Data Sets in a SAS Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694

Chapter 36 • Managing SAS Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695


Introduction to Managing SAS Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695
Choosing Your Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695
Understanding the DATASETS Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696
Looking at a PROC DATASETS Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698

Chapter 37 • Getting Information about Your SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . 701


Introduction to Getting Information about Your SAS Data Sets . . . . . . . . . . . . . . . . . 701
Input Data Library for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702
Requesting a Directory Listing for a SAS Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702
Requesting Contents Information about SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . 704
Requesting Contents Information in Different Formats . . . . . . . . . . . . . . . . . . . . . . . . 708
x Contents

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710

Chapter 38 • Modifying SAS Data Set Names and Variable Attributes . . . . . . . . . . . . . . . . . . . 713
Introduction to Modifying SAS Data Set Names and Variable Attributes . . . . . . . . . . 713
Input Data Library for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714
Renaming SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714
Modifying Variable Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724

Chapter 39 • Copying, Moving, and Deleting SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . 725


Introduction to Copying, Moving, and Deleting SAS Data Sets . . . . . . . . . . . . . . . . . 725
Input Data Libraries for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726
Copying SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727
Copying Specific SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730
Moving SAS Libraries and SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731
Deleting SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734
Deleting All Files in a SAS Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737

PART 10 Understanding Your SAS Environment 739

Chapter 40 • Introducing the SAS Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 741


Introduction to the SAS Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 741
Starting a SAS Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 742
Selecting a SAS Processing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 751

Chapter 41 • Using the SAS Windowing Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 753


Introduction to Using the SAS Windowing Environment . . . . . . . . . . . . . . . . . . . . . . 754
Getting Organized . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 755
Finding Online Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 758
Using SAS Windowing Environment Command Types . . . . . . . . . . . . . . . . . . . . . . . . 758
Working with SAS Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 761
Working with Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 766
Working with Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 770
Working with SAS Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775
Working with Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 792

Chapter 42 • Customizing the SAS Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 793


Introduction to Customizing the SAS Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . 794
Customizing Your Current Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795
Customizing Session-to-Session Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 798
Customizing the SAS Windowing Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 807
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 809
Contents xi

PART 11 Appendix 811

Appendix 1 • Complete DATA Steps for Selected Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 813


Complete DATA Steps for Selected Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 813
The CITY Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 814
The UNIVERSITY_TEST_SCORES Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 815
The YEAR_SALES Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 816
The HIGHLOW Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 817
The GRADES Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 818
The USCLIM Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 819
The CLIMATE, PRECIP, and STORM Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820

Appendix 2 • DATA Step Debugger Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 823


Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 823

Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 839
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 859
xii Contents
xiii

About This Book

Syntax Conventions for the SAS Language

Overview of Syntax Conventions for the SAS Language


SAS uses standard conventions in the documentation of syntax for SAS language
elements. These conventions enable you to easily identify the components of SAS
syntax. The conventions can be divided into these parts:
• syntax components
• style conventions
• special characters
• references to SAS libraries and external files

Syntax Components
The components of the syntax for most language elements include a keyword and
arguments. For some language elements, only a keyword is necessary. For other
language elements, the keyword is followed by an equal sign (=). The syntax for
arguments has multiple forms in order to demonstrate the syntax of multiple arguments,
with and without punctuation.
keyword
specifies the name of the SAS language element that you use when you write your
program. Keyword is a literal that is usually the first word in the syntax. In a CALL
routine, the first two words are keywords.
In these examples of SAS syntax, the keywords are bold:
CHAR (string, position)
CALL RANBIN (seed, n, p, x);
ALTER (alter-password)
BEST w.
REMOVE <data-set-name>
In this example, the first two words of the CALL routine are the keywords:
CALL RANBIN(seed, n, p, x)
The syntax of some SAS statements consists of a single keyword without arguments:
DO;
xiv About This Book

... SAS code ...


END;
Some system options require that one of two keyword values be specified:
DUPLEX | NODUPLEX
Some procedure statements have multiple keywords throughout the statement syntax:
CREATE <UNIQUE> INDEX index-name ON table-name (column-1 <,
column-2, …>)
argument
specifies a numeric or character constant, variable, or expression. Arguments follow
the keyword or an equal sign after the keyword. The arguments are used by SAS to
process the language element. Arguments can be required or optional. In the syntax,
optional arguments are enclosed in angle brackets ( < > ).
In this example, string and position follow the keyword CHAR. These arguments are
required arguments for the CHAR function:
CHAR (string, position)
Each argument has a value. In this example of SAS code, the argument string has a
value of 'summer', and the argument position has a value of 4:
x=char('summer', 4);

In this example, string and substring are required arguments, whereas modifiers and
startpos are optional.
FIND(string, substring <, modifiers> <, startpos>
argument(s)
specifies that one argument is required and that multiple arguments are allowed.
Separate arguments with a space. Punctuation, such as a comma ( , ) is not required
between arguments.
The MISSING statement is an example of this form of multiple arguments:
MISSING character(s);
<LITERAL_ARGUMENT>argument-1<<LITERAL_ARGUMENT>argument-2 ... >
specifies that one argument is required and that a literal argument can be associated
with the argument. You can specify multiple literals and argument pairs. No
punctuation is required between the literal and argument pairs. The ellipsis (...)
indicates that additional literals and arguments are allowed.
The BY statement is an example of this argument:
BY <DESCENDING> variable-1 <<DESCENDING> variable-2 …>;
argument-1 <option(s)> <argument-2 <option(s)> ...>
specifies that one argument is required and that one or more options can be
associated with the argument. You can specify multiple arguments and associated
options. No punctuation is required between the argument and the option. The
ellipsis (...) indicates that additional arguments with an associated option are
allowed.
The FORMAT procedure PICTURE statement is an example of this form of multiple
arguments:
PICTURE name <(format-option(s))>
<value-range-set-1 <(picture-1-option(s))>
<value-range-set-2 <(picture-2-option(s))> …>>;
Syntax Conventions for the SAS Language xv

argument-1=value-1 <argument-2=value-2 ...>


specifies that the argument must be assigned a value and that you can specify
multiple arguments. The ellipsis (...) indicates that additional arguments are allowed.
No punctuation is required between arguments.
The LABEL statement is an example of this form of multiple arguments:
LABEL variable-1=label-1 <variable-2=label-2 …>;
argument-1 <, argument-2, ...>
specifies that one argument is required and that you can specify multiple arguments
that are separated by a comma or other punctuation. The ellipsis (...) indicates a
continuation of the arguments, separated by a comma. Both forms are used in the
SAS documentation.
Here are examples of this form of multiple arguments:
AUTHPROVIDERDOMAIN (provider-1:domain-1 <, provider-2:domain-2, …>
INTO :macro-variable-specification-1 <, :macro-variable-specification-2, …>
Note: In most cases, example code in SAS documentation is written in lowercase with a
monospace font. You can use uppercase, lowercase, or mixed case in the code that
you write.

Style Conventions
The style conventions that are used in documenting SAS syntax include uppercase bold,
uppercase, and italic:
UPPERCASE BOLD
identifies SAS keywords such as the names of functions or statements. In this
example, the keyword ERROR is written in uppercase bold:
ERROR <message>;
UPPERCASE
identifies arguments that are literals.
In this example of the CMPMODEL= system option, the literals include BOTH,
CATALOG, and XML:
CMPMODEL=BOTH | CATALOG | XML |
italic
identifies arguments or values that you supply. Items in italic represent user-supplied
values that are either one of the following:
• nonliteral arguments. In this example of the LINK statement, the argument label
is a user-supplied value and therefore appears in italic:
LINK label;
• nonliteral values that are assigned to an argument.
In this example of the FORMAT statement, the argument DEFAULT is assigned
the variable default-format:
FORMAT variable(s) <format > <DEFAULT = default-format>;

Special Characters
The syntax of SAS language elements can contain the following special characters:
xvi About This Book

=
an equal sign identifies a value for a literal in some language elements such as
system options.
In this example of the MAPS system option, the equal sign sets the value of MAPS:
MAPS=location-of-maps
<>
angle brackets identify optional arguments. A required argument is not enclosed in
angle brackets.
In this example of the CAT function, at least one item is required:
CAT (item-1 <, item-2, …>)
|
a vertical bar indicates that you can choose one value from a group of values. Values
that are separated by the vertical bar are mutually exclusive.
In this example of the CMPMODEL= system option, you can choose only one of the
arguments:
CMPMODEL=BOTH | CATALOG | XML
...
an ellipsis indicates that the argument can be repeated. If an argument and the ellipsis
are enclosed in angle brackets, then the argument is optional. The repeated argument
must contain punctuation if it appears before or after the argument.
In this example of the CAT function, multiple item arguments are allowed, and they
must be separated by a comma:
CAT (item-1 <, item-2, …>)
'value' or "value"
indicates that an argument that is enclosed in single or double quotation marks must
have a value that is also enclosed in single or double quotation marks.
In this example of the FOOTNOTE statement, the argument text is enclosed in
quotation marks:
FOOTNOTE <n> <ods-format-options 'text' | "text">;
;
a semicolon indicates the end of a statement or CALL routine.
In this example, each statement ends with a semicolon:
data namegame;
length color name $8;
color = 'black';
name = 'jack';
game = trim(color) || name;
run;

References to SAS Libraries and External Files


Many SAS statements and other language elements refer to SAS libraries and external
files. You can choose whether to make the reference through a logical name (a libref or
fileref) or use the physical filename enclosed in quotation marks. If you use a logical
name, you typically have a choice of using a SAS statement (LIBNAME or
FILENAME) or the operating environment's control language to make the reference.
Syntax Conventions for the SAS Language xvii

Several methods of referring to SAS libraries and external files are available, and some
of these methods depend on your operating environment.
In the examples that use external files, SAS documentation uses the italicized phrase
file-specification. In the examples that use SAS libraries, SAS documentation uses the
italicized phrase SAS-library enclosed in quotation marks:
infile file-specification obs = 100;
libname libref 'SAS-library';
xviii About This Book
xix

What’s New in Step-by-Step


Programming with Base SAS 9.4

Overview

Step-by-Step Programming with Base SAS 9.4 shows you how to create SAS programs
step by step. You are provided with conceptual information and examples that illustrate
the SAS concepts. You can execute the programs in this document and view the results.
This document contains the basic information that you need to begin writing and
debugging your SAS code.
The following enhancements have been made to the documentation:
• additional information about debugging SAS programs
• new method of concatenating SAS variables
• updated sections on Output Delivery System (ODS)
In the third maintenance release for SAS 9.4, the following enhancements have been
made to the documentation:
• discussion of the DSD option was added to the documentation about list input
• directions for viewing ODS style templates were updated (see “Customizing ODS
Output at the Level of a SAS Job” on page 667)
• discussion of the IN= data set option was added to the documentation about merging
data sets

Debugging SAS Programs

Additional information and examples of SAS log output have been added. Items in the
SAS log are explained so that you can more easily debug your own SAS programs.
Documentation for the DATA step debugger has been added. The DATA step debugger
is a tool that enables you to find logic errors in your program. A description of the tool
and examples are provided. A list of commands that you use with the debugger is also
provided.
xx Step-by-Step Programming

Concatenating SAS Variables

A preferred method of concatenating SAS variables has been introduced. You use the
CAT function to return a concatenated character string.

Output Delivery System (ODS)

The sections about the Output Delivery System (ODS) have been updated, and new
information has been added. ODS gives you greater flexibility in generating, storing, and
reproducing SAS procedure and DATA step output along with a wide range of
formatting options. ODS provides formatting functionality that is not available when
using individual procedures or the DATA step without ODS.
Beginning with SAS 9.3, the default destination in the SAS windowing environment is
HTML, and ODS Graphics is enabled by default. These new defaults have several
advantages. Graphs are integrated with tables, and all output is displayed in the same
HTML file using a new style. This new style, HTMLBlue, is an all-color style that is
designed to integrate tables and modern statistical graphics. The examples in this
document now show HTML output.
xxi

Accessibility Features of Step-by-


Step Programming with Base SAS
9.4

Overview
For information about the accessibility of Base SAS, see the SAS 9.4 Companion for
Windows.
xxii Accessibility Features of Step-by-Step Programming with Base SAS 9.4
1

Part 1

Introduction to the SAS System

Chapter 1
What is the SAS System? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Chapter 2
Working with Output Defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2
3

Chapter 1
What is the SAS System?

Introduction to the SAS System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3


Components of Base SAS Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Overview of Base SAS Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Data Management Facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Programming Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Data Analysis and Reporting Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Output Produced by the SAS System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Traditional Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Output from the Output Delivery System (ODS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Ways to Run SAS Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Selecting an Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
SAS Windowing Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
SAS/ASSIST Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Noninteractive Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Batch Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Interactive Line Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Running Programs in the SAS Windowing Environment . . . . . . . . . . . . . . . . . . . . 13
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

Introduction to the SAS System


SAS is an integrated system of software solutions that enables you to perform the
following tasks:
• data entry, retrieval, and management
• report writing and graphics design
• statistical and mathematical analysis
• business forecasting and decision support
• operations research and project management
• applications development
4 Chapter 1 • What is the SAS System?

How you use SAS depends on what you want to accomplish. Some people use many of
the capabilities of the SAS System, and others use only a few.
At the core of the SAS System is Base SAS software, which is the software product that
you will learn to use in this documentation. This section presents an overview of Base
SAS. It introduces the capabilities of Base SAS, addresses methods of running SAS, and
outlines various types of output.

Components of Base SAS Software

Overview of Base SAS Software


Base SAS software contains the following:
• a data management facility
• a programming language
• data analysis and reporting utilities
Learning to use Base SAS enables you to work with these features of SAS. It also
prepares you to learn other SAS products, because all SAS products follow the same
basic rules.

Data Management Facility


SAS organizes data into a rectangular form or table that is called a SAS data set. The
following figure shows a SAS data set. The data describes participants in a 16-week
weight program at a health and fitness club. The data for each participant includes an
identification number, name, team name, and weight (in U.S. pounds) at the beginning
and end of the program.

Figure 1.1 Rectangular Form of a SAS Data Set

variable

IdNumber Name Team StartWeight EndWeight

1 1023 David Shaw red 189 165

2 1049 Amelia Serrano yellow 145 124 observation

3 1219 Alan Nance red 210 192

4 1246 Ravi Sinha yellow 194 177 data value

5 1078 Ashley McKnight red 127 118

data value

In a SAS data set, each row represents information about an individual entity and is
called an observation. Each column represents the same type of information and is called
a variable. Each separate piece of information is a data value. In a SAS data set, an
observation contains all the data values for an entity; a variable contains the same type of
data value for all entities.
Components of Base SAS Software 5

To build a SAS data set with Base SAS, you write a program that uses statements in the
SAS programming language. A SAS program that begins with a DATA statement and
typically creates a SAS data set or a report is called a DATA step.
The following SAS program creates a SAS data set named WEIGHT_CLUB from the
health club data:
data weight_club; 1
input IdNumber 1-4 Name $ 6-24 Team $ StartWeight EndWeight; 2
Loss=StartWeight-EndWeight; 3
datalines; 4
1023 David Shaw red 189 165 5
1049 Amelia Serrano yellow 145 124 5
1219 Alan Nance red 210 192 5
1246 Ravi Sinha yellow 194 177 5
1078 Ashley McKnight red 127 118 5
;6

The following list corresponds to the numbered items in the preceding program:
1 The DATA statement tells SAS to begin building a SAS data set named
WEIGHT_CLUB.
2 The INPUT statement identifies the fields to be read from the input data and names
the SAS variables to be created from them (IdNumber, Name, Team, StartWeight,
and EndWeight).
3 The third statement is an assignment statement. It calculates the weight each person
lost and assigns the result to a new variable, Loss.
4 The DATALINES statement indicates that data lines follow.
5 The data lines follow the DATALINES statement. This approach to processing raw
data is useful when you have only a few lines of data. (Later sections show ways to
access larger amounts of data that are stored in files.)
6 The semicolon signals the end of the raw data, and is a step boundary. It tells SAS
that the preceding statements are ready for execution.

Note: By default, the data set WEIGHT_CLUB is temporary. It exists only for the
current job or session. For information about how to create a permanent SAS data
set, see “Introduction to DATA Step Processing” on page 27.

Programming Language

Elements of the SAS Language


The statements that created the data set WEIGHT_CLUB are part of the SAS
programming language. The SAS language contains statements, expressions, functions
and CALL routines, options, formats, and informats – elements that many programming
languages share. However, the way you use the elements of the SAS language depends
on certain programming rules. The most important rules are listed in the next two
sections.

Rules for SAS Statements


The conventions that are shown in the programs in this documentation, such as indenting
of subordinate statements, extra spacing, and blank lines, are for the purpose of clarity
and ease of use. They are not required by SAS. There are only a few rules for writing
SAS statements:
6 Chapter 1 • What is the SAS System?

• SAS statements end with a semicolon.


• You can enter SAS statements in lowercase, uppercase, or a mixture of the two.
• You can begin SAS statements in any column of a line and write several statements
on the same line.
• You can begin a statement on one line and continue it on another line, but you cannot
split a word between two lines.
• Words in SAS statements are separated by blanks or by special characters (such as
the equal sign and the minus sign in the calculation of the Loss variable in the
WEIGHT_CLUB example).

Rules for Most SAS Names


SAS names are used for SAS data set names, variable names, and other items. The
following rules apply:
• A SAS name can contain from one to 32 characters.
• The first character must be a letter or an underscore (_).
• Subsequent characters must be letters, numbers, or underscores.
• Blank spaces cannot appear in SAS names.

Special Rules for Variable Names


For variable names only, SAS remembers the combination of uppercase and lowercase
letters that you use when you create the variable name. Internally, the case of letters does
not matter. “CAT,” “cat,” and “Cat” all represent the same variable. But for presentation
purposes, SAS remembers the initial case of each letter and uses it to represent the
variable name when printing it.

Data Analysis and Reporting Utilities


The SAS programming language is both powerful and flexible. You can program any
number of analyses and reports with it. SAS can also simplify programming for you with
its library of built-in programs known as SAS procedures. SAS procedures use data
values from SAS data sets to produce preprogrammed reports, requiring minimal effort
from you.
For example, the following SAS program produces a report that displays the values of
the variables in the SAS data set WEIGHT_CLUB. Weight values are presented in U.S.
pounds.
proc print data=weight_club;
title 'Health Club Data';
run;
Components of Base SAS Software 7

This procedure, known as the PRINT procedure, displays the variables in a simple,
organized form. The following output displays the results:

Figure 1.2 Displaying the Values in a SAS Data Set

To produce a table showing mean starting weight, ending weight, and weight loss for
each team, use the TABULATE procedure.
proc tabulate data=weight_club;
class team;
var StartWeight EndWeight Loss;
table team, mean*(StartWeight EndWeight Loss);
title 'Mean Starting Weight, Ending Weight,';
title2 'and Weight Loss';
run;

The following output displays the results:

Figure 1.3 Table of Mean Values for Each Team

A portion of a SAS program that begins with a PROC (procedure) statement and ends
with a RUN statement (or is ended by another PROC or DATA statement) is called a
PROC step. Both of the PROC steps that create the previous two outputs comprise the
following elements:
• a PROC statement, which includes the word PROC, the name of the procedure that
you want to use, and the name of the SAS data set that contains the values. (If you
omit the DATA= option and data set name, the procedure uses the SAS data set that
was most recently created in the program.)
• additional statements that give SAS more information about what you want to do, for
example, the CLASS, VAR, TABLE, and TITLE statements.
• a RUN statement, which indicates that the preceding group of statements is ready to
be executed.
Discovering Diverse Content Through
Random Scribd Documents
The following Letters, addressed by Mr. Whitefield to the inhabitants
of Savannah, as they display his affections to the people, among
whom he went to minister, so will be no unsuitable introduction to
the Account of the Orphan-house. It may not be improper to
observe, that Mr. Whitefield’s first arrival at Savannah, was May 7,
1738; he laboured assiduously in that place, ¹ and the
neighbouring settlements, till August 28 following, and then went
to South Carolina, and embarked on board the Mary, Captain Cae,
for England, that he might receive priest’s orders, for his further
service to that people, and raise contributions for erecting an
Orphan-house in the new colony at Georgia, which he saw was
greatly wanted.

¹ See his letter from Savannah, dated June 10, 1738. Vol. I.
p. 44.

To the Inhabitants of Savannah.

From on board the Mary, October 2, 1738.

My good Friends,

A S God has been pleased to place you more especially under my


care; so whether absent or present, I think it my duty to
contribute my utmost endeavours towards promoting the salvation
of your precious and immortal souls. For this end, and this only, God
is my judge, came I amongst you; for this end am I now parted from
you for a season; and for this end do I send you this general epistle.
I love, I pray for, therefore do I write to you all without exception.
But what shall I write to you about? Why, of our common salvation,
of that one thing needful, of that new birth in Christ Jesus, that
ineffable change which must pass upon our hearts, before we can
see God, and of which you have heard me discourse so often. Let
this, this, my dear friends, be the end of all your actions. Have this
continually in view, and you will never do amiss. The author of this
blessed change, is the Holy Ghost, the third person in the ever-
blessed Trinity. The Father made, the Son redeemed, and the Holy
Spirit is to sanctify, and so apply Christ’s redemption to our hearts.
The means to attain this Holy Spirit, you know, and the way you
know; Self-denial, and the way of the Cross. “If any man will come
after me (says Jesus Christ) let him deny himself, and, take up his
cross daily, and follow me.” And, I cannot but think it a particular
blessing, which you enjoy above others; because you are in a new
colony, where daily crosses must necessarily fall in your way. O then,
I beseech you by the mercies of God in Christ Jesus, make a virtue of
necessity, and take up your daily crosses with resignation and
thanksgiving. Another means to attain the Holy Spirit, is public
worship: for Christ has promised, “where two or three are gathered
together in his name, there will he, by his Spirit, be in the midst of
them.” For your zeal in this particular, I have often blessed God
within myself, and made mention of it to others. O continue like-
minded, and as in my presence, so in my absence, do not forsake
the assembling yourselves together in the house of God; for there
you will have the scriptures read, though not expounded; and the
Holy Spirit, if you apply to him, will open your understandings, and
guide you into all truth. Many other means there are of attaining the
Holy Ghost, such as, reading the scriptures,—secret prayer,—self-
examination, and receiving the blessed Sacrament;—all which I
would insist on, could they be comprised in a letter. But this must be
deferred till I see you in person, and am qualified to administer unto
you the sacred symbols of Christ’s blessed body and blood. In the
mean while, think not that I shall forget you in my prayers; no, I
remember my promise, and whilst the winds and storms are blowing
over me, I make supplication to God in your behalf. Though absent
in body, I am present in spirit, and joy in hopes of hearing of your
zeal for the Lord. Remember, my dear friends, that for the space of
near four months, I ceased not, day and night, warning every one of
you to repent and turn to God, and bring forth fruits meet for
repentance. Repent you therefore, and walk in all things as
becometh the gospel of our Lord Jesus Christ, and then, and then
only, shall your sins be blotted out. Finally, my brethren, be all of
one mind. Let there be no divisions among you; for a kingdom
divided against itself cannot stand. Be over careful for nothing, but
in every thing, with supplications and thanksgiving make your wants
known unto God. Speak not evil one of another, brethren, but live at
peace among yourselves; and the God of peace shall in all things
direct and rule your hearts. Brethren, pray for us, that God would
prosper the works of his hands upon me, and restore me to you as
soon as possible. In about eight months, God willing, I hope to see
you; in the mean while, you shall not be forgotten by

Your affectionate, though unworthy minister in Christ Jesus,

G. W.

To the Inhabitants of Savannah.

London, January 19, 1739.

My dear Friends,

T HOUGH a woman may as soon forget her sucking child, yet, I


fear, you have before this time thought, that I have forgotten
you. But God forbid! As I have told you often, so I tell you again;
You are upon my heart, so that I am ready to live and die with you;
and, God willing, as soon as my affairs are finished in England, I
shall return to you again. The Trustees have now appointed me
minister of Savannah, and granted all I desired of them, so that I
have nothing to do, but to watch over your souls, that I may present
you blameless at the coming of our Lord Jesus Christ. Be stedfast
therefore, my brethren, be unmoveable. Carefully attend to the
words spoken by your present Pastor, and strive to enter in at the
strait gate. Let love be without dissimulation. Let not slander so
much as be named amongst you, as becometh saints. Be not slothful
in business; yet take heed that you are fervent in spirit, serving the
Lord. Pray without ceasing. In every thing give thanks; and assure
yourselves, you are continually remembered by

Your most affectionate Pastor,

G. W.

P. S. My business in England detaining me longer than I


expected, I have therefore written this to assure you, that I will
return as soon as possible. ¹

¹ Mr. Whitefield embarked for America, the ―― of August


following.
AN
ACCOUNT of the Orphan-House in
Georgia.

PREFACE.

B EING now about to embark for Georgia, I am willing, before I go,


to give the world a short account of the Orphan-House erected
there. I have, therefore, in the following sheets, reprinted a
continuation of an account published when I was last at Edinburgh;
to which I have subjoined some letters received since; and also an
account of money received and disbursed since the publication of
that account: and in order to give the reader a view of this design
from its beginning, I have affixed my preface to the account I first
published about two years ago. I commend it to God. May he give it
his blessing!

G. W.

London, January 14, 1743.

Bethesda, December 23, 1741.

T HE following sheets, to the best of my knowledge, contain a


faithful account of what money I have received, as also how I
have disbursed it, for the use of the Orphan-House in Georgia.
I think, with a full assurance of faith I may affirm, the Lord put it
into my heart to build that house. It has prospered beyond
expectation. It has already, and I hope will more and more answer
its name, Bethesda, and be a House of Mercy to the souls and
bodies of many people, both old and young.

When I left England, I proposed to take in only twenty children;


but when I arrived at Georgia, I found so many objects of charity,
besides the orphans, among poor people’s children, that I resolved
in this, as well as in all other respects, to imitate Professor Franck,
and make a provision for their maintenance also.

Two of the orphan boys were put out apprentices just before I
last left Savannah; one to a bricklayer, the other was bound to a
carpenter; a third is to be bound to the surgeon belonging to the
Orphan-House; one weaves in a loom at home; two I have put to a
taylor I brought over, and the rest are now fitting themselves to be
useful to the commonwealth. Whoever among them appear to be
sanctified, and have a good natural capacity, these, under God, I
intend for the ministry.

None of the girls are put out as yet, but are taught such things
as may make them serviceable whenever they go abroad. Two or
three of them spin very well. Some of them knit, wash, clean the
house, get up the linen, and are taught house-wifery. All that are
capable, are taught to sew. And the little girls, as well as the boys,
are employed in picking cotton. I think I have no less than three
hundred and eighty-two yards of cloth already in the house, and as
much yarn spun as will make near the same quantity; a thing not
known before in Georgia.

I have now forty-nine children under my care, twenty-three


English, ten Scots, four Dutch, five French, seven Americans.
Twenty-two of these are fatherless and motherless, sixteen of them
boys, and six girls. The others are some fatherless, and some
without mothers; all objects of charity except three, whose friends
recompense the Orphan-House for their maintenance. One of the
orphans is an infant; I pay four shillings per week for nursing it.
Since December last, we have had above eighteen more children
that have been maintained occasionally, to assist their parents, but
were dismissed when they were wanted at home.

The account which I find Mr. Seward has given of our œconomy,
has in a great measure prevented my doing it as I intended. Let it
suffice to inform our benefactors, that though the children are
taught to labour for the meat which perisheth, yet they are
continually reminded to seek first the kingdom of God and his
righteousness, and then to depend upon God’s blessing on their
honest endeavours, for having food and raiment added unto them.
This precept of our Lord, I intend, when the house is finished, to
have written over against the entrance in at the great door.

As my design in founding the Orphan-House was to build up


souls for God, I endeavour to preach chiefly to the children’s hearts.
But that they may be able to give a reason of the hope that is in
them, I constantly instruct them by the Church of England’s Articles,
which I turn into catechetical questions. I am often pleased to hear
how judiciously some will answer the questions put to them. The
power of God has been frequently visible among the children. Many
of the girls seem to be tender-hearted; several of the boys have
been under strong convictions. And though it sometimes seems
buried, yet I cannot but think the seed of grace is sown in some of
their hearts.

We are now all removed to Bethesda. We live in the out-houses


at present; but in less than two months, the great house will be
finished so as to receive the whole family.

It is now weather-boarded and shingled, and a piazza of ten feet


wide built all around it: which will be wonderfully convenient in the
heat of summer. One part of the house would have been entirely
finished, had not the Spaniards lately taken from us a schooner
loaded with ten thousands bricks, and a great deal of provision, with
one of our family. And therefore, I could not till very lately procure
another boat to fetch brick from Charles-Town.

Notwithstanding this, and many other hindrances, the work has


been carried on with great success and speed. There are no less
than four framed houses, a large stable and cart-house, beside the
great house. In that there will be sixteen commodious rooms,
besides a large cellar of sixty feet long and forty wide. Near twenty
acres of land are cleared round about it, and a large road is made
from Savannah to the Orphan-house, twelve miles in length: a thing,
ever since the province has been settled, without a precedent.

None but those upon the spot can tell the expence, as well as
inconvenience that attends building in Georgia. Most of the bricks
already used, cost 40s. sterling per thousand, when landed at the
plantation. Common labourers, besides their provisions, have 25s.
sterling a month. And, after all, ♦the produce of the land cultivated
by white servants, will scarcely furnish them with ordinary food and
raiment, exclusive of the expences of sickness and wages. I cannot
see how it is possible for the Colony to subsist on its present footing.
And in a late memorial given in to the Honourable Trustees,
unknown to me, the people have declared, that if it were not for the
money that has been expended on account of the Orphan-house,
the poor inhabitants of the northern parts of the colony must have
been obliged to move to some other place. Never did a country
stand more in need of a charity-school.

♦ removed duplicate word “the”

We have often been in some difficulties, but the Lord as often


hath relieved us out of them. When the schooner was lost, a person
lately converted, sent us eleven barrels of rice, and five barrels of
beef. And in my absence, when my family had little or no provisions,
the Indians brought in plenty of deer, till they were supplied with
food some other way. The contributions in Charles-Town, New-
England, New-York, and Pensilvania, I think have been extraordinary.

The infirmary, which has likewise been supported by this


institution, has been of great service. The surgeon informs me, that
if every one had been forced to pay for their nursing and medicines,
it would have cost them two hundred pounds, sterling. I have now
three or four sick: I keep a woman to attend them constantly.

God has much blessed our family with health. Only two have died
out of so large a number, since my arrival; and these were two that
came with me from England: a taylor, and one of the women: I
believe they are now with God.

I have left behind me, as my assistants, (who have no other


gratuity than food and raiment) two school-masters and their wives
who are school-mistresses. One young man, who is also married to a
young maiden, lately brought home to God, I have left at the
Orphan-house, as superintendent, and chief manager of the outward
things. There are also the surgeon and his wife, a shoemaker and
spinstress; besides labourers and monthly hired servants: I think, in
all, I have upwards of eighty. The Lord, I am persuaded, is able and
willing to provide for them.

I think we have near two hundred hogs, and one hundred head
of cattle. I give a man forty pounds sterling, per annum, to take care
of them; he providing himself with provision, horses, and a servant.
As yet we have had no advantage from our stock, it being a very dry
season last summer; so that our cattle of all kinds have scarcely food
to eat. But in a year or two, we hope, by the divine blessing, to have
a considerable quantity of fresh provisions for our family.

As for manuring more land than the hired servants and great
boys can manage, it is impracticable without a few negroes. It will in
no wise answer the expence.
I am now upwards of eight hundred pounds in debt, on the
Orphan-house account. Some particular friends have been pleased
to assist me. I doubt not but our Lord will enable me to pay them,
and also raise up fresh supplies for the maintenance of my large
family.

I much rejoice in the institution: it has been very beneficial, not


only to the bodies, but also to the souls of the labourers. One
woman received Christ very lately at Bethesda: and I have great
reason to believe, that three or four strangers, who came to see us,
have been effectually brought home to God.

Great calumnies have been spread abroad concerning our


management of the children: people shoot out their bitter arrows in
America, as well as in England. One poor man was filled with such
resentment, at the reports he had heard of our cruelty to the
children, that he came on purpose from South-Carolina, to take
away his two boys, whom out of compassion, I had taken into the
Orphan-House: but, when he came and saw the manner in which
they were educated, he was so far from taking his children away,
that he desired to come and live at the Orphan-house himself.

I speak not this by way of boasting, or to wipe off reproach; for I


know, let me do what I will, I shall never please some men. I
thought proper to give this short account, for the satisfaction of
those who have already contributed, and of others who may be
stirred up by our good God, to contribute hereafter towards carrying
on this good design.

That the children may learn to be grateful, they frequently sing


the following hymn for their benefactors:
I.

Father of Mercies, hear our prayers,

For those that do us good;

Whose love for us a place prepares,

And gives the orphans food.

II.

Their mites, in blessings on their heads,

A thousand fold restore;

O feed their souls with living bread,

And let their cup run o’er.

III.

Thy bounty, Lord, in Christ built up,

Let them for ever prove:

Stedfast in faith, joyful thro’ hope,

And rooted deep in love.

IV.

For those, who kindly this support,

A better house prepare:

And when remov’d to thy bless’d courts,

O let us meet them there.

That they may always look to the rock from whence they are
hewn, they sing daily this hymn.
I.

Come let us join our God to bless,

And praise him evermore;

That Father of the fatherless,

That helper of the poor.

II.

Our dying parents us forsake,

His mercy takes us up,

Kindly vouchsafes his own to make,

And he becomes our hope.

III.

For us, He, in the wilderness,

A table has prepar’d;

Us, whom his love delights to bless,

His providence to guard.

IV.

Known unto him are all our wants,

And when we seek his face,

His open hand our bodies feeds,

He feeds our souls with grace.

V.

Then let us in his service spend,

What we from Him receive;


And back to Him what he shall lend,

In thanks and praises give.

That they may learn to labour truly to get their own living, they
sing as follows, before they go to work,
I.

Let us go forth, ’tis God’s command;

Let us make haste away,

Offer to Christ our hearts and hands,

We work for Christ to-day.

II.

When he vouchsafes our hands to use,

It makes our labour sweet.

If any now to work refuse,

Let not that sluggard eat.

III.

Who would not do what God ordains,

And promises to bless?

Who would not ’scape the toils and pains

Of sinful idleness?

IV.

In vain to Christ the slothful pray;

We have not learn’d him so.

No: for he calls himself the way,

And work’d himself below.

V.

Then let us in his footsteps tread,

And gladly act our part;


On earth employ our hands and head,

But fix on heaven our heart.

The following hymn was composed to be sung at the admission


of a new child or children.
I.

Welcome, dear brethren, whom we love;

Bethesda this we call.

A house of mercy may it prove

To you, to us, to all!

II.

What tho’ our parents dear are dead,

Yet our great God provides.

Our bodies here are cloth’d and fed;

Our souls have christian guides.

III.

The heavenly manna, day by day,

They freely do impart;

Let us not trifle time away!

But lay it in our heart.

IV.

O let the love of Christ constrain!

Why should we need a rod?

Few e’er such blessed means obtain

Of leading them to God.

Besides these hymns, they generally sing a grace before and


after meat, and are taught so to vary their exercises, that they may
not be cloyed by a too frequent repetition of the same things on the
one hand, and yet are kept in such a general method, that they may
not learn to be desultory and fickle on the other.

God only knows the concern that lies upon me on account of this
family, not only in respect to their bodily, but their spiritual provision.
And therefore I hope all that wish well to Zion, will help me with
prayers, as well as their alms, that it may grow up a holy temple to
the Lord, and be blessed; that it may rightly be stiled Pietas
Georgiensis, and like the Pietas Hallensis, or Professor Franck’s
Orphan-House at Glaucha, near Hall, become the joy of the whole
earth. Even so, Lord Jesus, Amen, and Amen.

G. W.
A
Continuation of the Account of the Orphan-House in
Georgia.
Edinburgh, September 14, 1742.

E VER since the Lord has been pleased to put me into the ministry,
it has been my constant prayer to God, that I might provide
things honest in the sight of all men. Not one part of my outward
conduct, as I know of, hath passed unobserved and uncensured by
some wicked unreasonable men: but what seems to have given the
greatest offence, and caused the loudest outcry, has been my
making public collections for an Orphan-House in Georgia.

Some indeed affirm that there is no such thing. But how it could
enter into the heart of any to say so, I should not have conceived,
unless the scripture had said, the heart of man is desperately
wicked.

Somewhat more than a twelve-month ago, I printed an account


of the situation and oeconomy of the Orphan-House, and what I was
in arrears when I left Georgia, January 1741. My chief design now,
is, to give a short account of the progress of the work since, both as
to our temporal and spiritual concerns, so far as lies in my power.

The salvation of souls is the chief thing I had in view, when God
put it into my heart to build this house. I would then begin with that
first.

And here I would pause a while, and acknowledge that I am


much indebted to the divine goodness, for what he has already done
for many souls, since its first institution. I must confess, to the glory
of God, it has far exceeded my expectations.

During the time I was among them, before my going to, and
after my return from, Philadelphia, Boston, &c. there were several
remarkable awakenings amongst the children, and others, belonging
to the house, much resembling the blessed awakening now at
Cambuslang, and other places in these kingdoms; as will appear
from consulting some of my latest Journals. Just before I came last
away, the Lord was much amongst us; at which time, a young man,
about twenty-one years of age, was converted, who since has been
made a blessed instrument of converting many poor negroes in
South-Carolina. Several others also, that came to pay us a visit at
the Orphan-House, were really brought home to God, and now bring
forth the fruits of the spirit in their lives and conversations. How it
has been with my family since my departure, will best appear by
publishing some extracts from the letters which have been sent me
from time to time, since my departure.

Mr. Habersham, superintendent of the outward affairs in the


Orphan-House, and who, I am persuaded, loves the Lord Jesus in
sincerity, writes me thus:

Bethesda, March 24, 1741.

My dearest Friend and Brother,


――
T
HE spirit of the Lord seems to be moving upon the faces of
many souls here; most, if not all the boys, seem to be under
some concern; little as well as great boys, cry mightily to Jesus the
son of David, to have mercy upon them. About fourteen days ago, at
brother Barber’s request, I spoke to the children at evening prayer.
My soul at that time was bowed down with a sense of my own, and
especially of your poor lambs deadness to God; but our gracious
Redeemer, who is always ready to help in time of need, was pleased
to give me power to speak to their consciences. I think I could and
did justly appeal to their hearts, that they wanted neither bodily or
spiritual food: I told them, that they, as well as myself, could not be
insensible what little care was taken of them before they came to us,
and consequently how ungrateful they were not to improve such
means as they now enjoyed: I beseeched them, by the mercies of
God, that they would improve this their day of salvation, that we and
our benefactors might rejoice; we in the work of our hands, they in
the fruit of their bounty. An impression was made on some; I
observed them the next day retire into the woods, to sing and pray
together. Two nights afterwards, I spoke to them again, and as I
promised, so I returned them my public thanks for their little
amendment, with tears of love and joy: I felt the Lord powerfully on
my own soul, and it seemed to reach the children, and put them
under a visible concern. Ever since, brother Barber has put the great
boys into two companies, and they constantly meet together every
day to sing and pray. Saturday, the 21st instant, the presence of the
Lord came down among the children, little and great, as they were
talking among themselves about eternity; and they cried so much to
Jesus of Nazareth, to have mercy upon them, that the family soon
heard them. We all went, saw, and wept over about twenty-five or
thirty dear lambs, upon their knees before God, some pleading the
promises, and others calling on Jesus. O how did my hard heart
rejoice! Blessed be God, many of them seem to retain their
convictions, and all are serious. Does not your soul leap for joy, and
say, Bless the Lord, O my friends, and let us magnify his name
together! Indeed, my dear brother, all the glory is due to him. Whilst
I am writing, I blush, that I should mention any thing about what I
was only in a little measure an instrument. Methinks I could wish to
disappear, that the creature might be abased, and God be all in all. I
have great hopes that God will bring some effectually to himself. The
work seems to be more solid among them, and more the effect of
consideration, than that of last summer. I rejoice much, that the Lord
sent brother Barber among us; for I have neither leisure nor ability
to speak much to the children, and he seems to delight to watch
over their souls: I trust the Lord will make him a blessing to us all; I
think it will be our own fault if he is not. One or two of the
labourers, I hope, have closed with Jesus for salvation; and one or
two more are in a fair way to do so.

Mr. Habersham, in another Letter, writes thus from Charles-


Town.

June 11, 1741.


――
S
ATAN rages furiously against our Orphan-House in this
province: such lies and calumnies are raised against us, that
our few dear friends think it necessary for me to represent the
present state of the house. I have since been much in prayer, and
believe God will direct me how to act. Some here, since you went
away, have gone great lengths in asserting calumnies, even so as to
offer to take oaths for the truth of them. Since I came, I went to
them, to enquire what foundation they had for such reports; and it
would surprise you to see their behaviour: they are ashamed to lift
up their faces. Thus shall the wicked stand dumb at the bar of God. I
think I can say, to the glory of God, that our family never was in a
better condition. The children, the essence of our constitution, are
well taken care of, and watched over. We all live in love. God has
been visibly among us, especially with the children. Bethesda, as to
its outward circumstances, is so much for the better, that you would
be surprised to see it. God enables us to keep up much order. He
likewise (blessed be his name) has given us the appearance of a
plentiful crop. The garden and plantation now afford us many
comfortable things, and in great plenty. Our stores are yet well
stocked with flour and beef, &c. Mr. W―― behaves with great
integrity, and is faithful in his work. The house would be soon
finished, if we could get bricks. J. S. is ready to do all our bricklayers
work gratis. Brother W―― is a great blessing to the family. If you
come by way of Philadelphia, pray bring some hemp and coarse flax.
He has weaved and spun a great deal for us. All the boys now lye in
the great house. They have also coats, and lye in sheets of their
own making: by this means they are kept sweet and clean. We have
a fine growing stock of cattle; and if God should so order it, that we
should have a plantation in Carolina, as I believe he will bring to
pass, we shall need but little, if any, assistance from abroad. If our
building were now done, our expences would be but trifling to what
they have been.

Mr. Barber writes me thus.

Bethesda, September 4, 1741.

My dearly beloved Brother,

N OT knowing but our Lord may have business for you at the
northward, and send you thither before you return to us; I
have sent you a few lines, to acquaint you with the present state of
your family. Many of us have been sick; but, blessed be God, our
sickness has not been unto death. O that it may be for the glory of
God’s name! All of us are in good health at present, except James
M――h, who was taken with the flux a few days ago, and
B. ♦ Habersham, who is much troubled with the worms. I wish I
could say our souls were in as good health as our bodies are; but
you may give thanks to the Lord, that he has made your house a
house of mercy indeed to some. A few weeks ago, the Lord was
pleased effectually to call Thomas W――b; his conversion was very
clear, and much to the satisfaction of some, especially to his good
old father. Mr. K――y, our taylor, and his wife, have been wrought
upon, I hope savingly, since they have been here: I am not without
hope that some of the children are likewise, and that the Lord in due
time will convert more of them. I hope he is now shewing us that
the work is wholly of him; that when the day of his power, the time,
the appointed time of his love is come, we may be better prepared
to give all the glory thereof to him. As to myself, I must confess that
I am a poor worthless instrument, to be employed in the work of the
Lord; but what shall we say, if the Lord is pleased to make use of the
foolish to confound the wise? I have, blessed be God, had a little
freedom given me lately to speak to your family; but I want to have
my heart more and more enlarged towards them, and to speak to
them more and more in the demonstration of the Spirit, and with
power. Who knows? perhaps God designs you should have the
honour and happiness of being the spiritual father of many more in
your family. May the Lord’s will be done!

♦ “Haversham” replaced with “Habersham”

I have also some letters of a later date, which give an account of


the continuance of the Lord’s presence amongst them.

As for the temporal affairs, blessed be God, considering the great


difficulties we have laboured under, they also have succeeded far
beyond expectation.

Mr. Habersham, in a Letter dated March 24, 1741, writes


thus:

A S we have got so much land cleared, I intend to try to plant it:


accordingly I have four or five hands, which, with our own
houshold, will be sufficient to plant twenty acres or upwards with
potatoes and rice for fodder next winter, having greatly suffered this,
for want of it; likewise corn and pease, and other necessaries. Our
garden is in great forwardness: we are like to have a crop of English
pease. God visibly blesses us, so that people are amazed.

In a Letter, dated September 1, 1741, he writes thus to a


Gentleman in New-England: of which Letter I had a copy.
――
O
UR affairs, blessed be God, have prospered far beyond our
expectation. We have seen, and do daily see, much of God’s
fatherly care, in providing for and protecting us; and though we
have no visible fund, yet we doubt not, but he that has begun, will
carry on and perfect his work against every opposition. We have
been plentifully supplied all the summer, while many about us
lacked. Our building and necessary conveniences, are now
compleated. Our family now consists of eighty-four persons, men,
women, and children, and nineteen more are employed about us,
and five in the Infirmary: the latter have a doctor and nurse, and all
other necessaries found them at the Orphan-house expence. We
have fifty-eight children: thirty-two of them belong to the colony; six
to Purisburgh, who are, I think, as great objects of charity as any in
Georgia; and the rest belong to the neighbouring provinces, who are
orphans and objects of charity, except a few who are maintained at
their friends and parents charge. We have a taylor and shoemaker:
likewise two weavers; each of them have got a loom, but we can
employ but one, spinning here being extravagantly dear; though we
hope in a short time to spin as much within ourselves, as will greatly
assist in cloathing the family. God blesses our cattle; we have
upwards of an hundred head, small and great, and shall be able in a
year or two to kill a great quantity. Negroes not being allowed, and
labour among us so expensive, we can make but little improvement
in farming. This year we have planted upwards of twenty acres, and
have cleared twenty acres more for to enjoy the conveniency of the
air: and, blessed be God, though we have had a very dry season, yet
we cannot complain, like many others, of a bad crop. Honoured Sir,
you may now judge whether our design be drawing near a period.
What I have written is a plain impartial narrative of our affairs, which
our bitterest enemies will not pretend to gainsay. If any doubt it, I
answer, as Philip did to Nathaniel, Come and see.

In a Letter, dated October 2, 1741, he writes thus:


―― R. Wardrop and I have settled, his contract being finished: he
M is about some necessary jobs now, and will leave us in a few
days. Messrs. Trip, Anderson, &c. are already gone: I owe them and
Mr. Wardrop about seventy or eighty pounds. We are very quiet, and
live at an easy expence. We have had no supplies since you left us,
of flesh or bread kind from abroad, except some pork from Mr.
B――. No New-York vessels have come to this province of late. We
live entirely within ourselves, except a few necessaries which we
cannot do without, that we are obliged to purchase elsewhere. Twice
a day we eat hominy ¹ of our own raising, and at present without
molasses. For dinner, we eat beef of our own stock, and pease for
bread, of all which we have plenty, and shall have for three months
to come. Our garden is very fruitful of greens, turneps, &c. and we
expect a good crop of potatoes. In short, we have a sufficiency of
wholesome food. Glory be to God, we daily see our heavenly Father’s
hand supplying us in this wilderness-land. O that we were more
thankful! I must have cash, not only to pay debts, but also to buy
clothing and many other necessaries; and I believe our God will give
it to me. He is our shepherd, therefore shall we lack nothing. I trust
he has enabled us to pray in faith, nothing doubting but he will
supply our every want. All here at present enjoy pretty good health.
How thankful ought we to be! The Lord seems to be sending his
judgments abroad upon the earth. In Carolina and Savannah a
murrain is among the cattle, which takes off great numbers: ours as
yet have escaped. Thanks be to God! Indeed we are obliged to kill
some of them for immediate supply. But what are all outward
calamities, where God is?

¹ Indian corn boiled up thick with water.

A young Gentleman of Boston, having made a visit to the Orphan-


House, sent the following account of it to his father, which many
have desired may be printed, for the satisfaction of those who
have already contributed to its support.

Bethesda, January 1, 1742.

Honoured Sir,

B EING sensible of the many and false accounts industriously


spread abroad concerning this house in many places, especially
in New-England, by those who are enemies to its Founder, and the
cause he is engaged in, which has certainly been a great hindrance
to this worthy undertaking, as it has created even in its friends some
prejudices, which has hindered their contributing with that pleasure
and freedom they otherwise would have done; and as I am now
upon the spot, I think a few moments will not be ill spent, in giving
you a particular account of its present situation, which I shall
endeavour to do in the most just and impartial manner, that you may
have an opportunity of serving the interest in which your heart is so
much engaged.

The Orphan-House is pleasantly situated, and, with the buildings


belonging to it, presents a much handsomer prospect than is given
by the draught annexed to the public accounts. The great house is
now almost quite finished, and nothing has hindered but the want of
glass, which they daily expect from Bristol, and some bricks that are
already at Savannah, and are to carry up another stack of chimnies,
which would have been done before, if a vessel that was bringing
brick and other stores, had not been taken by the Spaniards, which
was a great loss. It is surprizing to see in what forwardness things
are, considering what hindrances they have had, and the scarcity of
labourers in this province. They have cut a fine road to Savannah of
twelve miles length, through a thicket of woods; and, that it might
be passable, were obliged to make ten bridges and cross-ways;
which was done at no little charge. They have also cleared forty
acres of land, twenty of which were planted the last year, and
brought them a tolerable crop: the other twenty was for the benefit
of the air. They have also a large garden at the front of the house,
brought into pretty good order.

The family now consists of eighty persons besides labourers, who


all contradict the wicked and false accounts of their being starved
and cruelly treated, by the lively and hearty countenances they
shew. I have seldom seen such a goodly number of youths together.
Twenty-three of them are orphans; others, that have lost one of
their parents; one was born in the house; and the rest are fit objects
for christian charity. There are in all thirty-nine boys, and ♦ fifteen
girls. The number was larger some time past: but several of the
boys, that were well instructed, have been put to such trades as
they inclined to; and others, who were put here for their learning,
are returned to their parents, who have handsomely paid the House
for their education.

♦ “fifteeen” replaced with “fifteen”

The care of this society at present is in the hands of a young


gentleman from London, who manages the secular affairs thereof;
and one from New-England, who has the care of souls as his
particular charge. There are two school-masters, who instruct the
boys in reading and writing: and those that appear serious, and of
good capacities, are taught Latin, with a design of fitting them for
the ministry, if they incline to it. Two school-mistresses, that teach
the girls; a surgeon and nurse to attend the infirmary, in which many
sick persons, from divers parts, have been received, and always
been cured gratis. Here are also several tradesmen; a taylor, a joiner,
a weaver, and a shoemaker. The taylor has three boys to instruct in
his business. It is expected that Mr. Whitefield will increase the
number of craftsmen, when he returns from England. The œconomy
observed here is as follows: The bell rings in the morning at sun-
rise, to wake the family. When the children arise, they sing a short
hymn, and pray by themselves: then they go down and wash; and
by the time they have done that, the bell calls to public worship,
when a portion of scripture is read and expounded, a psalm sung,
and the exercise begun and ended with prayer. Then they breakfast,
and afterwards go some to their trades, and the rest to their prayers
and schools. At noon, they all dine in the same room, and have
comfortable and wholesome diet provided. A hymn is sung before
and after dinner: then, in about half an hour, to school again; and
between whiles find time enough for recreation. A little after sun-set
the bell calls to public duty again, which is performed in the same
manner as in the morning. After that they sup, and are attended to
bed by one of their masters, who then pray with them, as they often
do privately. On the sabbath-day they all dine on cold meat provided
the day before, that none may be kept from public worship, which is
attended four times a day in summer, and three in the winter. The
children are kept to reading between whiles. Many have reported,
that the place is very unhealthy: which I believe is quite otherwise,
considering it is a new settlement: a remarkable proof of which is,
that not one have died out of the family, (into which many sick and
almost starved children have been received, who have in a short
time recovered) and but three or four out of the hospital, where
many miserable objects have been taken in. I believe many, who
now think the erecting an Orphan-house in that colony a mad
scheme, would alter their sentiments were they here. Innumerable
difficulties have certainly been overcome; but their affairs now look
with a pleasant aspect. If the colony is allowed negroes, as it is
thought it must and will be, they can, with about twenty negroes to
manure the plantation, which contains five hundred acres of land,
raise much more provision than a larger family than this can expend,
having already a fine live stock, which is daily increasing; so that in a
few years, it is to be hoped, they will be able to support themselves.
As to the state of religion here, particularly among the children, the
power of God has, at times, been visible among them; and many of
them have been brought under conviction, which seems lasting in
some of the boys, and several of the girls: but most of the grown
folks appear to be truly converted; and many, who have come as
visitors, have been met with by the sovereign grace of God, and not
sent empty away: may God grant I may make one of that number!
Upon the whole, I think the institution to be of God: therefore it doth
and will prosper.

Since this came to my hand, I have received more letters from


Georgia, dated in May and June last, which also give me an account
of the continuation of God’s goodness to my dear family.

The Reverend Dr. Colman, in a letter he sent to a minister near


Glasgow, part of which I find printed in a pamphlet entituled, The
State of Religion in New-England, writes thus:
“Mr. Whitefield visited us in the right time, and found large
contributions here: I doubt not but he will faithfully apply what he
collected for his Orphan-house: but I have said to him, It will appear
to me a greater wonder, if his faith is answered in that foundation,
than that of Monsieur Franck’s, at Hall, in Prussia, was: the one
being in the midst of Europe, the other on the confines of America.
But the order and piety of the house is admirable, and so the
progress of the settlement, alone as it is in the world, by the report
of all that have visited it: but how it can subsist and flourish, and
answer the Founder’s end, is the enquiry here, and will be a marvel
in the providence of God, if it do so.”

The Reader may see, by this, the Doctor’s opinion of the Orphan-
house, and the testimony given concerning it by persons who have
visited it, and who therefore cannot be unacquainted with its
situation. They profess, “The order of the house is admirable, and so
the progress of the settlement, alone as it is in the world.” How it
can subsist and flourish for the future, I am not solicitous about: God
can help us in Georgia, as well as he helped Professor Franck in
Germany. The earth is the Lord’s, and the fulness thereof. I
acknowledge him to be the founder of that house: he put it into my
heart to build it: it has in a great measure already answered the end
of its institution, and I am persuaded will do so more and more. The
greatest outward difficulties, I humbly hope, are now surmounted.
The workmen are all discharged, having fulfilled their contract, and
carried on the work so far as to make every part of the house
habitable. Our stock of cattle is pretty considerable, and appear to
be in a flourishing condition. And, when once I am clear from all
arrears, the Orphan-house will be supported at a very easy expence.
The last parliament resolved to support the colony of Georgia: they
have altered the constitution in two material points; they have
allowed the importation of rum, and free titles to the lands. And if
they should see good hereafter to grant a limited use of negroes, it
must certainly, in all outward appearance, be as flourishing a colony
as South-Carolina. Not that we are without hopes, as Mr. Habersham
writes me word in his last letter, of making a tolerable shift with
white servants: the Saltzburghers do so already. There is a fresh
body of them lately gone over, and some fresh troops to guard the
frontiers of the colony. Not that I put any confidence in man,
knowing that the race is not to the swift, nor the battle to the
strong, but Providence ruleth all things: but, at the same time, I
would act with the greatest caution and circumspection, and not
tempt God by presuming on him without a cause. His having helped
me and mine so often, encourages me to trust him again. He has
put it into the hearts of some dear friends to give Mr. Habersham
credit for cash during my absence; and his Excellency General
Oglethorpe has been very friendly, having lent Mr. Habersham fifty
pounds, and given the orphans nine barrels of flour: the Lord return
him, and their other benefactors, ten thousand fold into their bosom!

But all this while, some will say, you give us no account of your
collections in Scotland and elsewhere for near this year and an half. I
will now do that to the best of my power, and likewise add an
account of my disbursements; I say, my disbursements: for, having
had no particular account of what Mr. Habersham has expended and
borrowed since I have been from Georgia, I cannot possibly give an
exact account of the whole; but I shall do it, God willing,
immediately after my arrival at the Orphan-house, beginning where
the former account left off. From that it appears, I was then upwards
of eight hundred pounds upon arrears. Since that I have been
absent near two years: and considering a family of eighty persons,
or upwards, have been maintained, an infirmary kept up, the
expence of further work done to the house, &c. it will not appear
unreasonable that I should be still upwards of six hundred pounds
on arrears; as I judge I am, from Mr. Habersham’s general
intimations of cash he had borrowed in America, and what I have
still to pay in England. But this will appear clear in the next account.
In the mean while, the following accounts, I believe, will be
satisfying to all the contributors ¹: as for others, I do not think myself
obliged to give them any account at all, any further than that I am
commanded to provide things honest in the sight of all men. Neither
do I believe, that this, or any account I can give, will satisfy captious
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like