Download as pdf or txt
Download as pdf or txt
You are on page 1of 53

Step by Step Programming with Base

SAS 9 4 Second Edition Sas Institute


Visit to download the full and correct content document:
https://textbookfull.com/product/step-by-step-programming-with-base-sas-9-4-second
-edition-sas-institute/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

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/

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/

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/

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/
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/

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/

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/

Serial Attached SCSI 4 SAS 4 r10b 6777

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

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/
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.
Another random document with
no related content on Scribd:
ähnlichen Verwüstungen, wie man sie hier täglich zu Dutzenden
sieht, vorzubeugen. Beim Europäer mit seiner weißen Haut ist das
Auffinden des Sandflohes übrigens weit leichter, als es den
Schwarzen gemacht wird, von deren Haut sich der dunkle Punkt
kaum abhebt. Die vier oder fünf Sandflöhe, die mich trotz steten
Tragens hoher, geschlossener Schnürschuhe bisher zu ihrem Sitz
auserkoren haben, hat mir der vielgewandte Knudsen
herausgehoben; ein Auswaschen der Höhlung mit Sublimat
erscheint mir dabei immer ganz angebracht. Die Neger haben ein
anderes Desinficiens, sie füllen die Öffnungen mit
Wurzelgeschabsel; in einem winzigen Makuadorf am Steilabhang
des Plateaus südlich von Newala sah ich eine Frau, die den Raum
unter den Nägeln prophylaktisch mit Wurzelpulver ausstopfte. Ob es
der Alten etwas nützen wird, wer weiß es.
Der Rest der vielen kleinen Hindernisse, die uns hier das Dasein
erschweren, wirkt mehr komisch als ernsthaft. In Ermangelung von
etwas anderem Rauchbaren greifen Knudsen und ich jetzt zu dem
Inhalt einer vom Inder in Lindi bezogenen Zigarrenkiste. Diese ist
sehr schön beklebt und aufgemacht, aber wehe dem Unglücklichen,
der sich, wie wir, mit ihrem Inhalt befaßt! Ob diese schwelenden
Giftnudeln Opium oder ein anderes Narkotikum enthalten, von uns
beiden weiß es niemand zu sagen, denn nach dem zehnten Zuge
sind wir beide „matt“; dreiviertel betäubt und hundeelend liegen dann
Wiking und Deutscher in sich zusammengesunken da. Langsam
erholt man sich — was geschieht? Nach einer halben Stunde greift
man doch wieder zu dem scheußlichen Kraut; so unstillbar ist hier in
den Tropen der Drang zum Rauchen!
Auch meine jetzigen Fieberanfälle sind kaum geeignet, noch
ernst genommen zu werden. Ich habe ihrer hier in Newala nicht
weniger als drei gehabt, aber alle mit unglaublich kurzem Verlauf.
Emsig fragend, schreibend und notierend quäle ich mich mit meinen
„Gelehrten“ herum, der starke Mittagskaffee hat die Lebensgeister
mächtig angeregt; das Gehirn arbeitet außerordentlich intensiv, so
daß die Arbeit rasch vorwärtsschreitet. Eine wohltuende Wärme
durchrieselt den ganzen Körper, macht jedoch mit einem Male einem
heftigen Kältegefühl Platz, das mich jetzt, beim wärmsten
Sonnenschein, nachmittags 3½ Uhr, bereits zwingt, den Überzieher
anzulegen. Jetzt arbeitet auch das Gehirn nicht mehr so scharf und
logisch, besonders bei syntaktischen Feststellungen des schwierigen
Imakuāni, der Sprache der Makua, an die ich mich zum Überfluß
auch noch herangewagt habe. Da halte ich es denn doch allmählich
für angezeigt, meine Temperatur zu messen, der Einfachheit halber
gleich im Sitzen und ruhig weiterarbeitend; 38,6° ist das Ergebnis!
Nun aber hinaus, meine Herren, heißt es im gleichen Augenblick!
Wenige Minuten später steht mein Bett in der Barasa; unmittelbar
darauf liege ich auch schon darin und beginne mich mit heißem
Zitronenwasser innerlich zu behandeln. Drei Stunden später zeigt
das Thermometer gegen 40°; ich lasse mich jetzt, beim Einsetzen
des Abendwindes, mitsamt meinem Bett ins Zelt zurücktragen —
würde ich meinen furchtbar schwitzenden Körper der eisigen
Abendtemperatur aussetzen, so könnte das meinen Tod bedeuten
—, liege dort noch eine kleine Weile und finde dann zu meiner
Beruhigung, daß das Fieber nicht mehr steigt, sondern anfängt
zurückzugehen. Das ist ungefähr 7½ Uhr; als ich kurz nach 8 Uhr
noch einmal messe, ist die Kurve zu meinem maßlosen Erstaunen
auf unter 37° heruntergegangen; mir ist absolut wohl; ich lese noch
ein paar Stunden und könnte sehr wohl rauchen, wenn ich etwas
Ordentliches hätte. Aber Inderzigarren? Pfui Teufel!
Wie ist so etwas denkbar? muß ich mich selbst als Laie fragen.
Das kann doch unmöglich Malaria sein; näher liegt die Vermutung,
daß diese rasch verlaufenden, hohen Fieberanfälle die Folge einer
zu intensiven Sonnenbestrahlung sind, eine Art Insolationsfieber
oder Sonnenstich. Wenn ich mein Fiebernotizbuch nachsehe, wird
mir dies immer wahrscheinlicher, denn regelmäßig treten diese
Anfälle im Anschluß an größere Strapazen und langen Aufenthalt in
praller Sonne ein. Für mich haben diese kurzen Unpäßlichkeiten
wenigstens das Gute, daß sie mich nur stundenweise von der Arbeit
abhalten, denn am nächsten Morgen bin ich regelmäßig wieder
vollkommen frisch und gesund.
Nicht so gut geht es leider meiner Perle von Koch und dem
Knaben Moritz; jener leidet an einer ungeheuren Hydrozele, die ihm
kaum erlaubt aufzustehen, Moritz aber hat Dunkelarrest wegen
seiner entzündeten Augen. Leider versteht Knudsens Koch, ein bis
vor wenig Wochen gänzlich unbeleckter Wilder von irgendwo aus
dem Busch, noch weniger als mein Omari. Folge: Nils Knudsen ist
selbst zum Koch avanciert. Er hat diese seine neue Tätigkeit
sogleich mit einer großen Tat begonnen; da wir nichts Ordentliches
mehr zu essen haben, hat er die vier von Matola erstandenen
Ferkel, hübsch säuberlich in einen großen Tragkorb gepackt, von
Chingulungulu heraufholen lassen und kaltblütig das größte von
ihnen gemordet. Den ersten Schweinebraten haben wir
leichtsinnigerweise doch Knudsens wildem Koch anvertraut; er war
infolgedessen ungenießbar; den Rest des Tieres haben dann wir zu
einem Gelee verarbeitet, das uns nach den langen Wochen der
Unterernährung herrlich mundet und von dem wir mittags und
abends geradezu fabelhafte Portionen vertilgen. Wenn nur nicht die
ewigen Teltower Rübchen dabei wären! O du gesegnete Stadt auf
märkischem Sande, wer hätte je geahnt, daß du so nachhaltig in die
Ernährung eines stillen, deutschen Gelehrten eingreifen würdest!
Dieser boshafte Dr. Jaeger! Er war ein Mann von Zeit und Muße; ihm
halste daher die Landeskundliche Kommission die Besorgung aller
Nahrungsmittel für seine und meine Expedition auf. Feierlich
überweist mir eines schönen Tages in Daressalam der mit der
Verpackung dieser Sachen betraute Handlungsbeflissene meinen
Anteil. Seitdem leide ich unter einer ständigen Rübenfurcht; ich habe
das Gericht an sich ganz gern, aber nur einmal im Jahre, ungern
häufiger. Doch wie ergeht es mir hier? Ich trete an die Kiste heran,
die gerade leergegessen werden muß; der Deckel fliegt hoch; ein
Griff hinein, eine Konservenbüchse kommt zum Vorschein; ein Blick
auf die Etikette: Teltower Rübchen. Puh! Die Dose verschwindet; ein
zweiter Griff; dasselbe Ergebnis; ein dritter, nichts anderes. Nach
langem Suchen erst kommt dann ein anderes Gemüse zutage; oder
auch nicht, denn diese anderen sind allmählich zu Ende gegangen,
nur die Teltower sind geblieben! „Denn helpt dat nich“, sage ich mit
Fritz Reuter; aber zehn Jahre lang esse ich zu Hause keine Teltower
mehr!
Bei all diesem kleinen Leid, das aber nun einmal dazu gehört, um
Afrika schmackhaft zu machen, gibt es wenigstens e i n erfreuliches
Moment: Nils Knudsen hat mit der Geschicklichkeit eines
Feinmechanikers meinen 9 × 12-Apparat wieder in Ordnung
gebracht oder ihn doch wenigstens so weit wieder hergestellt, daß
ich ihn mit einiger List gebrauchen kann. Wie der Mann ohne
Fingernägel mit dieser kniffligen Arbeit hat fertig werden können, bei
der er den ungemein komplizierten Momentverschluß nur mit Hilfe
eines plumpen Schraubenziehers auseinandernehmen und wieder
zusammensetzen mußte, ist mir noch heute schleierhaft, aber er hat
es geschafft. Der Mangel an Fingernägeln hingegen zeigt den guten
Nils von einer Seite, die mit seiner bei der Apparatreparatur
bewiesenen Intelligenz merkwürdig kontrastiert, die andererseits
allerdings auch aufs innigste mit seinem zehnjährigen
Hinterwäldlertum zusammenhängt. Wäscht er da eines Tages in
Lindi irgendeinen Köter. Dieser muß wohl eines schärferen
Reinigungsmittels bedürftig gewesen sein, denn Nils hat ein Gefäß
mitbekommen, dessen Inhalt stark und kräftig riecht. Gewissenhaft
nimmt unser Freund die Reinigung vor, wundert sich ein wenig, daß
sie dem Hunde sehr schlecht bekommt, ist dann aber sehr erstaunt
darüber, daß ihm seine eigenen zehn Fingernägel im Laufe weniger
Tage wegeitern. „Wie kann ich aber auch wissen, daß man
Karbolineum verdünnen muß“, knurrt er oftmals noch jetzt entrüstet,
wenn er seine schrecklich zugerichteten Fingerenden sorgenvoll
mustert!
Weit und breit haben wir die Umgegend durchschweift, seitdem
wir in Newala hausen; zunächst alter Gewohnheit gemäß, sodann
aber, weil der Akide Sefu mit der Zusammenstellung seines
Gelehrtenkollegiums durchaus nicht so rasch fertig geworden ist, wie
er sich zuerst anheischig gemacht hatte. Aber das schadet weiter
nicht, denn auch bloß von außen gesehen, sind Land und Leute
interessant genug.
Das Makondeplateau gleicht einer großen, rechtwinkligen, an
den Ecken abgerundeten Tafel; es ist, vom Indischen Ozean bis
Newala gemessen, etwa 120 Kilometer lang und im Mittel zwischen
dem Lukuledi und dem Rovuma gegen 80 Kilometer breit; es umfaßt
also gegen zwei Drittel der Fläche des Königreichs Sachsen. Nun ist
diese Fläche nicht horizontal, sondern von ihrem Südwestrande
flach, aber ganz gleichmäßig gegen den Ozean hin geneigt. Von der
Schwelle, auf der Newala liegt, kann man viele Meilen über den
Makondebusch nach Osten und Nordosten schauen, ohne einem
Hindernis zu begegnen; es ist ein grünes Meer, aus dem nur hie und
da dichte Rauchwolken in langer Erstreckung emporwirbeln und -
wallen, zum Zeichen dafür, daß auch hier Menschen wohnen und
daß sie ihre Feldkultur ganz nach der Weise so vieler anderer
Naturvölker vorwaltend auf die Verbrennung des
niedergeschlagenen Holzbestandes gründen. Dessen Asche ist
zugleich die einzige Düngung. Selbst am strahlend hellen Tropentag
ist so ein Brand ein großartiges Schauspiel.
Ungleich weniger wirkungsvoll ist der Eindruck, den gegenwärtig
die große Ebene vom Plateaurand aus erweckt. Sooft es mir meine
Zeit gestattet, unternehme ich den kleinen Ausflug an diesen Rand,
bald hierhin, bald dahin, stets in der stillen Hoffnung, endlich einmal
eine klare Luft mit weiter Aussicht vorzufinden; immer aber
vergebens: wohin man dort unten schaut, allerorten steigen
Rauchwolken hoch, der lebhafteste Beweis für die unausgesetzte
Tätigkeit des Waldbrennens; rauchig und dunstig ist auch die ganze
Luft. Schade drum, das Panorama von hier bis weit hinten an die
Madjedjeberge muß unter günstigeren Umständen wirklich großartig
sein. Jetzt haben photographische Aufnahmen eigentlich kaum einen
Zweck, die Profilzeichnung aber gibt nur einen sehr schwachen
Begriff der ganzen Szenerie.
Bei einem dieser Ausflüge habe ich mich absichtlich selbst
einmal am Makondebusch versucht. Der Plateaurand von heute ist
das Ergebnis einer ungeheuer tiefgreifenden Zerstörung durch
Erosion und Abrutschung; überall greifen kurze, aber Hunderte von
Metern tiefe Täler in die Makondeschichten ein. Eine Folge des
lockeren Gefüges dieser Formation ist es, daß nicht nur die
Seitenwände dieser Täler fast senkrecht abstürzen, sondern daß die
Täler auch mit einer ebenso steilen Rückwand enden; dergestalt ist
der Westrand des Makondeplateaus von lauter Talkesseln umsäumt.
Um von einer Seite eines solchen Kessels auf die andere zu
gelangen, habe ich mich eines Tages mit einem Dutzend meiner
Leute durch den Busch geschlagen. Es war eine sehr lichte Stelle,
mit mehr Gras als Buschwuchs; aber welche Mühe hat dieser Weg
von ein paar hundert Metern gekostet, und wie sahen wir alle
nachher aus! Die dünnen Kattunstoffe meiner Leute in Fetzen, sie
selbst aus hundert kleinen Wunden blutend; sogar unsere derben
Khakistoffe hatten den Dornen dieser Vegetationsformation nicht
standgehalten.

Negerpfad im Makondebusch. Gegend von Mahuta.

Meine seit langem gehegte Ansicht über die Entstehung dieses


Makondebusches hat sich immer mehr befestigt: er ist ohne Zweifel
kein Naturprodukt, sondern erst die Folge der menschlichen Kultur.
Wohin der Mensch hier oben auf dem Hochland noch nicht mit
Hacke und Axt gedrungen ist — ein halbwegs geübtes Auge sieht
dies ohne weiteres —, da steht auch heute noch ein wirklicher,
wunderschöner Hochwald, der den Vergleich mit unserem deutschen
Mischwald sehr wohl aufzunehmen vermag. Wo der Mensch aber
jemals seine Hütte gebaut und sein Feld beackert hat, da entsteht
hinterher dieser gräßliche Busch. Geht man auch nur ein paar
Stunden irgendwo auf dem Hochland die Barrabarra entlang, so hat
man vollauf Gelegenheit, diese Metamorphose in jeder Phase ihrer
Entwicklung zu verfolgen. Seitwärts tönt hallender Axthieb herüber,
nicht bloß von einer Stelle, sondern über einen ganzen Komplex
verteilt. Wenige Schritte weiter sieht der Wanderer, was vorgeht;
wohl meterhoch und höher liegt das niedergeschlagene Unterholz
geschichtet; zwischen ihm aber ragen als letzte Säulen alter Pracht
die Stämme des Hochwaldes. Doch auch sie gewähren ein Bild des
Jammers; der böse Makonde hat sie geringelt, d. h. er hat sie
ringsherum in breitem Bande der Rinde beraubt, so daß sie dem
Absterben verfallen sind; zudem hat er noch eine Reisigpyramide
um sie aufgebaut. Unverdrossen hacken Vater und Sohn, Mutter und
Schwiegersohn im Hintergrunde weiter; kaum daß das sonst so
neugierige Volk nach dem weißen Fremdling aufschaut. Und kommt
dieser Fremdling eine Woche später desselben Weges gezogen,
verschwunden ist das Reisig, verschwunden sind die Pyramiden;
eine dicke Aschenschicht lagert, wo vor kurzem noch grünender
Wald sich breitete. Die starken Bäume aber recken ihre noch immer
glimmenden, schwelenden Stämme und Äste in stummer Anklage
zum Himmel, oder aber sie sind bereits niedergebrochen, mehr oder
minder zu Asche verglüht und zeichnen sich dann als weißer
Streifen auf dunklem Grunde ab.
Das ist der Zerstörungsprozeß, den der Makonde in gleicher
Weise am jungfräulichen Urwalde wie auch an den Stellen seines
Heimatlandes vornimmt, wo er vor Jahren schon einmal geackert
hat, nur daß er im letztern Fall des Verbrennens der großen Bäume
überhoben ist. Diese gibt es in der sekundären Buschformation nicht
mehr.
In das gebrannte und mit der Hacke gelockerte Stück Waldland
sät der Eingeborene sein Getreide, pflanzt er sein Gemüse. Im
ganzen Lande hat er Beetkultur. Diese erfordert eine sorgsame
Pflege, die ihr der Neger auch zuteil werden läßt; Unkraut wird im
Süden Deutsch-Ostafrikas nicht geduldet. Mißernten kommen wohl
im trockneren Tiefland vor, auf dem niederschlagreicheren,
allmorgendlich taufeuchten Hochland sind sie ganz unbekannt.
Dessen glückliche Bewohner sind sogar in der angenehmen Lage,
die sonst so stolzen Yao und Makua von unten bei sich als Diener
und Knechte zu sehen. Hunger tut weh, und so ziehen es die
Angehörigen jener beiden Völkerschaften vor, einmal eine Zeitlang
da den Diener zu spielen, wo sie sonst zu herrschen gewohnt sind.
Jedoch der leichte sandige Boden ist bald erschöpft, er würde bei
einer nochmaligen Bestellung keine Ernte mehr ergeben. Dies weiß
der Eingeborene seit Jahrtausenden; längst hat er vorgearbeitet und
den Komplex nebenan mit Axt und Feuerbrand urbar gemacht. Auf
ihn siedelt er nunmehr mit seinen mannigfachen Kulturen über; das
alte Feld wird zur Brache. Doch nur ganz kurze Zeit liegt es wüst und
greulich anzusehen da, dann kommt Allmutter Natur und nimmt ihr
mißhandeltes Kind liebevoll in ihre Obhut; tausendfältig sprießt es
allerorten aus dem ausgesogenen Boden hervor, selbst die alten
Baumstrünke schlagen von neuem aus. Im nächsten Jahr ist der
Neuwuchs bereits mehr als kniehoch; rasch wuchert er in die Höhe;
nach wenigen Jahren schon ist er jener undurchdringliche,
schreckliche Busch, der erst wieder fällt, wenn der schwarze Herr
des Landes seinen Turnus beendigt hat und an die alte Stelle
zurückkehrt.
Mit diesem Busch sind die Makonde mit Leib und Seele
verwachsen, ja nach meinen Yaogewährsleuten bedeutet sogar ihr
Name nichts anderes als Buschvolk. Nach ihrer eigenen Tradition
sitzen die Makonde zwar schon seit langen, langen Zeiten hier oben,
aber zu meiner Überraschung legten sie doch eine sehr starke
Betonung auf eine ursprüngliche Einwanderung. Diese sei von
Südosten, von der Rovumamündung und von Mikindani her erfolgt;
der Anlaß dazu sei die ewige Beunruhigung ihrer friedlichen
Vorfahren durch die kriegerischen Schirasi der Küste und die
fortgesetzten Raubzüge der Sakalaven von Madagaskar herüber
gewesen; vor diesen hätten sich die Ur-Makonde auf das
unzugängliche Plateau zurückgezogen. Ich bin in der Völkerkunde
Afrikas auf Grund einer 20jährigen Beschäftigung mit ihr sehr wohl
bewandert, aber daß Bevölkerungsvorgänge in diesem so friedlich
und ruhig erscheinenden Erdteile sogar durch von außen kommende
Hochsee-Unternehmungen bedingt und veranlaßt worden seien, war
mir doch im ersten Augenblick etwas vollkommen Neues. Es wird
indessen schon seine Richtigkeit haben. Warum jedoch die
Makonde gerade im dicksten Busch und weit vom Plateaurand ab
wohnen müssen, und warum sie nicht an die rieselnden Quellen der
Niederung selbst zu dauerndem Wohnsitz herniedersteigen dürfen,
das lehrt aufs klarste ihre wunderhübsche Stammessage. Auch noch
manch anderes Lehrreiche steht darin.
„Die Geburtslandschaft des Stammes, mit Namen Mahuta, ist auf
der Südseite des Plateaus zum Rovuma hin gelegen; dort aber
stand nur dichter Busch. Aus diesem Busch hervor ging ein Mensch,
der sich niemals wusch und schor, der nur wenig aß und trank. Der
ging aus und machte ein Menschenbildnis aus dem Holze eines
Savannenbaumes, nahm es mit sich in seine Buschwohnung und
stellte es dort aufrecht hin. Während der Nacht erwachte das Bildnis
zum Leben, und es war ein Weib. Daraufhin gingen sie zusammen
hinunter zu den Wassern des Rovuma, um sich zu waschen. Hier
gebar das Weib ein Kind, welches jedoch nicht lebend zur Welt kam.
Sie verließen das Land und zogen über die Hochländer bis in das Tal
des Mbemkuru, wo sie sich niederließen. Dort gebar das Weib
abermals ein Kind, das wiederum tot zur Welt kam. Daraufhin
kehrten sie in die hochgelegene Buschlandschaft Mahuta zurück,
und dort wurde das dritte Kind geboren, welches nach der Geburt
am Leben und gesund blieb. Mit der Zeit zeugten sie noch viele,
viele Kinder und hießen sich Wamatanda. Diese bildeten die
Stammfamilie der Makonde, auch Wamakonde genannt, d. h.
Urbewohner. Der Stammvater, der Buschmensch, aber gab seinen
Kindern das Gesetz, daß sie ihre Toten aufrecht begraben sollen
zum Andenken an die erste Mutter, die aus Holz geschnitzt und
aufrecht stehend zum Leben erwacht sei; ferner warnte er seine
Kinder, in die Täler und an die großen Wässer zu ziehen, denn dort
wohne die Krankheit und der Tod. Als Regel solle gelten, daß
mindestens eine Stunde Weges sei von der Hütte bis zum
Wasserplatze; dann würden ihre Kinder gedeihen und von
Krankheiten verschont bleiben.“
Die Urmutter.
Holzskulptur eines
Makondekünstlers.
Die Erklärung des Namens Makonde lautet bei meinen
Gewährsleuten etwas anders als bei Pater Adams, dessen kleinem,
aber inhaltreichem Büchlein: „Lindi und sein Hinterland“ ich diese
Stammessage der Makonde entnehme. Aber sonst stimmt mein
Befund genau mit dem sachlichen Inhalt dieser Stammessage
überein. Waschen? Hapana, gibt es nicht. Wozu auch? Zudem ist
das Wasser spärlich und reicht kaum zum Kochen und Trinken; von
den anderen tut es ja auch keiner; warum soll also gerade ich so
unangenehm auffallen? Scheren aber ist bei dem kurzen,
krauswolligen Haarwuchs kaum vonnöten; also auch dieser
Vorschrift des Urahnen ist leicht zu folgen. Damit aber hört das, was
uns lächerlich dünkt, auf. Von einer Reihe hiesiger Künstler habe ich
eine ziemlich große Anzahl stattlicher, 40 bis 60 Zentimeter hoher
Holzskulpturen erworben, die allesamt Frauen aus der großen
Völkergruppe der Mavia, Makonde und Wamatambwe darstellen; die
Figuren sind merkwürdig gut gearbeitet und geben den Frauentypus
vortrefflich wieder, vor allem auch die später noch zu schildernde
Verschönerung des Körpers mit Ziernarben. Über Zweck und
Bedeutung ihrer Werke befragt, wußten die Künstler nichts
Plausibles anzugeben, oder aber, was ich heute für wahrscheinlicher
halte, sie wollten nicht. Also:

Was man sich nicht erklären kann,


Das sieht man als ’nen Fetisch an.

Ehrlich gestanden, ich habe diesen ins Ethnographische


variierten alten Vers beim Empfang jener Figuren laut in den
sonnendurchglühten Tropentag hinausgesprochen, aber ich habe
wohlweislich nicht danach gehandelt. Einstweilen mußte ich mich mit
der kargen Angabe eines der Künstler begnügen, die Figuren gäben
lediglich das „nembo“ wieder, die Körperverunstaltung durch Lippen-
und Ohrscheiben und Ziernarben. Mit der Adamsschen Sage jedoch
rücken diese Figuren ohne weiteres in ein anderes Licht, sie sind
doch mehr als zwecklose Kostümpuppen, ja man darf dreist
annehmen, daß sie, wenn auch der Mehrzahl der heutigen Makonde
unbewußt, Darstellungen jener Urmutter sind. Diesmal wäre der alte
Vers also doch angebracht gewesen, denn die Urmutter gehört
ebenso in den Kreis des hiesigen Eingeborenenkultus wie die Ahnen
überhaupt.
Auf die Vorgeschichte des Volkes bezieht sich in der
Stammessage unzweifelhaft zunächst der Hinweis auf den Abstieg
von Mahuta hinunter zu den Wassern des Rovuma, sodann der
andere auf die Wanderung über die Hochländer bis in das Tal des
Mbemkuru; beide Wanderungen des Urelternpaares bedeuten in
Wirklichkeit wohl Wanderungen des Volkes selbst. Der Abstieg in
das nahe, an seinen Rändern außerordentlich fruchtbare und
wildreiche Rovumatal ist ohne weiteres verständlich; doch auch das
Überschreiten der Lukuledisenke, der Aufstieg zum Rondoplateau
und der erneute Abstieg zum Mbemkuru liegen durchaus innerhalb
des Bereichs der Wahrscheinlichkeit, denn alle diese Gebiete weisen
genau dieselben Naturbedingungen auf wie der äußerste Süden.
Nun kommt aber etwas gerade für unser „bakterielles“ Zeitalter
höchst Interessantes. Die Ur-Makonde sind in den sumpfigen
Flußniederungen ihres Lebens nicht froh geworden, Krankheiten
waren bei ihnen an der Tagesordnung, und viele starben; erst
nachdem sie wieder nach Mahuta in die Heimat zurückgekehrt
waren, besserte sich der Gesundheitszustand des Volkes. Wir sehen
im Neger gern und mit Vorliebe den naturfremden und
naturfürchtigen Dümmling, dem alles Ungemach von bösen Geistern
und Naturgewalten herrührt. Viel richtiger wird es sein, hier
anzunehmen, daß die Leute malariadurchseuchte und malariafreie
Gebiete sehr bald haben unterscheiden lernen. Diese Erkenntnis
schlägt sich dann nieder in der Warnung des Urvaters, nicht wieder
in die Täler und an die großen Wässer zu ziehen, denn dort wohne
die Krankheit und der Tod. Um aber auch gleichzeitig vor den bösen
Mavia auf der Südseite des Rovuma gesichert zu sein, wird noch
bestimmt, daß jede Siedelung um einen Minimalabstand von jenem
Steilrand abliegen solle. So wohnen sie heute noch.
Sie wohnen so auch ganz gut, jedenfalls besser und geschützter
als die Makua, die modernen Eindringlinge des Südens, die hier auf
dem Westrande des Plateaus in ziemlich breiter Zone Fuß gefaßt
haben. Von der Stattlichkeit der Yaohäuser unten in der Ebene und
besonders in Massassi, Susa und Chingulungulu hat weder die
Behausung der Makua, noch die der Makonde etwas an sich. Jumbe
Chauro, ein an der Barrabarra nach Mahuta unweit Newala
gelegener Makondeweiler, ist von allen mir bisher bekannten
Siedelungen des Stammes noch der bei weitem stattlichste; seine
Hütten sind auch recht geräumig. Doch wie ruppig ist ihre bauliche
Ausführung gegenüber den fast eleganten Palästen der
Elefantenjäger in der Ebene! Das Dach ist noch verwahrloster, als es
in der Trockenzeit hier überall Usus ist; an den Wänden nur hie und
da die kümmerlichen Anfänge oder die kläglichen Reste eines
Lehmbewurfs; das Innere aber eine wahre Hundehütte; Schmutz,
Staub und Unordnung überall; von Zimmereinteilung ist nur in
wenigen Hütten etwas zu merken, und dann ist sie auch nur durch
ganz liederlich zusammengeflickte Bambuswände hergestellt.
Nur in einem habe ich hier einen Fortschritt feststellen können, in
der Methode des Hausverschlusses. Diese ist im ganzen Süden bei
aller Einfachheit sinnreich; die Tür besteht stets aus derben Stangen
von Bambus oder Holz, die mit dem uns schon bekannten
Bindemittel des Baumbastes an zwei Querriegel gebunden werden;
auch die Drehung um den einen Türpfosten erfolgt in zwei Schleifen,
und zwar nach innen. Will der Bewohner sein Haus verlassen, so
nimmt er zwei derbe Stangen her, oberarmdick und etwa 1,5 Meter
lang. Die eine lehnt er von innen schräg gegen die Mitte der Tür, so
daß sie einen Winkel von 60 bis 75 Grad mit dem Erdboden bildet;
dann nimmt er die andere Stange, dreht sie horizontal und drückt sie
mit aller Kraft auf die erste Stange hernieder. Dabei helfen ihm zwei
andere kräftige Pfeiler, die in einigem Abstand einwärts von den
Türpfosten stehen; sie sind das Widerlager für die Horizontalstange.
Der Verschluß ist absolut sicher; nur läßt er sich natürlich nicht bei
beiden Haustüren, der Vorder- und Hintertür, ausführen. Denn wie
sollte der Besitzer sonst in das Haus hineingelangen? Ich bin aber
einstweilen noch nicht über den Hintertürverschluß unterrichtet.
Der allgemein übliche Türverschluß.
Das ist also der Universalverschluß. Derjenige der Makonde von
Jumbe Chauro ist viel feiner, gediegener und origineller. Auch hier ist
in bezug auf die Tür alles wie sonst, nur steht an ihrer Innenseite ein
einzelner Pfahl etwa 15 Zentimeter von der Türkante ab frei im
Hüttenraum; in der Hüttenwand aber befindet sich an dieser Stelle
ein Loch, gerade groß genug, um den Arm hindurch zu stecken. Der
Tag ist heiß gewesen, nun aber will es Abend werden; still und
verlassen liegt das Makondedörfchen im dichten Busch verborgen
da. Es ist vollständig menschenleer, denn die ganze
Einwohnerschaft ist zu Schmaus und scharfem Umtrunk ins
Nachbardorf geladen. Jetzt nahen sich schlürfende Schritte, der
Hausvater und die Seinen kehren zurück; sie sind zum nicht
geringen Trost für alle diejenigen Blaßgesichter, die aller
Abstinenzbewegung zum Trotz noch immer gern ihr Gläschen Bier
genehmigen, in keiner anderen Verfassung, als man sich nach einer
schweren Sitzung auch bei uns befindet. Nur singt der Makonde
nicht; Africa non cantat; in dieser Beziehung wird er also nie ein
guter Deutscher werden! Jetzt kommt das Knifflige. Der Negerpapa
hat natürlich die Pflicht, das Haus zu öffnen. O ihr Göttinger
Semester, wie klar steht ihr wieder vor meiner Seele mit eurem
unermeßlichen Hausschlüssel, für den kein Schneider die Taschen
groß genug machen konnte, für dessen Last selbst die hintere
Hosenschnalle eigens verstärkt werden mußte! Größer als du,
unerläßliches Requisit froher Scholarenzeit, ist das Format auch
kaum, das der alte Neger aus irgendeinem Versteck zum Vorschein
bringt, nur Gestalt und Material sind anders als am Leinestrand.
Eisen ist eine plebejische Erfindung fremder, hergelaufener Völker,
der Makonde bleibt nach wie vor beim Holz; und wirklich geschickt
findet er sich damit ab: der Schlüssel ist ein etwa 30 Zentimeter
langer, etwas geschweift gearbeiteter Stab mit abgesetztem Griff;
der Bart hat drei derbe Zapfen, die gleich lang sind und in ein und
derselben Ebene liegen. Etwas unsicher — auch wieder à la
Göttingen — sucht Papa das Schlüsselloch, pardon, das Loch in der
Wand. Das hat er vermöge seiner Größe bald entdeckt. Mit nicht
unberechtigtem Stolz wagt er einen schüchternen Blick nach hinten,
wo Mama, den unvermeidlichen Sprößling im Rückentuch, geduldig
— sie ist ja heute mitschuldig — der Lösung des Problems harrt.
Diese ist wirklich nicht ganz leicht, die Pombe war gut und der Tag
war heiß; merkbar zittert die sonst so ruhige schwarze Hand, als der
alte Herr beginnt, die Öffnung für den Schlüssel zu suchen. Schon
hebt sich, einem Entenschnabel gleich, die siebenzentimetrige
Lippenscheibe der holden Gattin zu scharfer Aufmunterung, da ist
das große Werk endlich gelungen, das feine, rechteckige Loch in
dem freistehenden Pfeiler ist gefunden; rack, rack, rack, ein
dreimaliges rasches Heben und Senken des Schlüssels, schon zieht
er einen langen Riegel hinter sich her und quer durch den Pfeiler
hindurch. Dieser Riegel hatte mit seinem kolbenförmigen freien Ende
sich fest gegen die Innenseite der Tür gestemmt, sie dadurch
hermetisch verschließend; jetzt ist der kluge Neger gekommen, hat
mit seinem Schlüssel im Innern jenes Pfeilers in senkrechten Nuten
laufende Klötzchen gehoben und hat damit den Verschluß gelöst;
leicht und frei gleitet der Riegel zurück.

Türverschluß bei den Makonde von Jumbe Chauro.


Mit nicht geringem Selbstbewußtsein hat mir erst ein Hausvater
diese größte Erfindung des Hochlandes an Ort und Stelle
vordemonstriert, und dann ein anderer; beide Male habe ich ein
bewunderndes „Msuri sana, sehr schön!“ ausgerufen und den
Wunsch geäußert, diese Wunderdinge mit nach dem fernen Uleia zu
nehmen, um dort den Wasungu zu zeigen, was für tüchtige Kerle die
Makonde seien. Noch bin ich keine fünf Minuten in meinen Windfang
von Newala zurückgekehrt, da keucht es auch schon heran; im
selben Augenblick senken sich zwei stattliche Bäume vor meinen
Augen nieder, und feierlich, wie nach siegreicher Belagerung,
überreichen mir zwei stark schwitzende Gestalten die Schlüssel zum
Tor der gefallenen Feste. Zum Schlüssel gehört auch das Schloß,
hatten die beiden Kommandanten ganz logisch gedacht; ein Griff
nach der Axt, krachend fliegt das scharfe, dem trocknen, zähen
Tropenholz gegenüber jedoch zu weiche Eisen in die Basis des
schloßtragenden Pfeilers hinein. Den Pfahl aus dem Boden
auszugraben und ihn dergestalt intakt herbeizuschaffen, das war
den beiden Intelligenzen nicht eingefallen. So liegen die Stücke halb
zertrümmert vor mir, und statt einer Belobigung bekommen die
beiden Besitzer noch Schelte.
Auf der Suche nach dem Schlüsselloch.
Die Makuahütten sind in der Umgebung von Newala besonders
kümmerlich; in ihrer mehr als liederlichen Bauart erinnern sie mich
lebhaft an die Interimsbauten der Makua von Hatia; und dabei haben
die hiesigen Vertreter des Stammes durchaus keinen Krieg
mitgemacht. Es muß also wohl angeborene Faulheit sein, oder aber
das Fehlen einer straffen Häuptlingshand. Selbst die Barasa von
Mlipa, eine kleine Stunde südöstlich von Newala, nimmt an dieser
allgemeinen Verwahrlosung teil; während sonst die öffentlichen
Bauten hierzulande stets der Gegenstand einiger Sorgfalt sind, läuft
sie sichtlich Gefahr, vom ersten besten kräftigen Oststurm
umgewirbelt zu werden. Von einigem Reiz in dem ganzen weiten
Siedelungsdistrikt ist lediglich das Grab des verstorbenen Häuptlings
Mlipa selbst. Ich habe es in den ersten Vormittagsstunden einmal
besucht, wo noch brauende Nebel mit der durchbrechenden Sonne
kämpften; da sah der kreisrund angelegte Hain haushoher
Euphorbien, die nebst einem zerbrochenen Tongefäß allein noch von
der Ruhestätte des alten Negerkönigs zeugen, fast weihevoll aus.
Auch meine sonst so materiell und realistisch veranlagten Träger
mochten so etwas fühlen, denn sie sangen heute nicht ihre
gewohnten Schelmenlieder, sondern feierlich klang es, als wir von
dannen zogen, in den dichten, grünen Makondebusch hinein und
über ihn hinaus weithin den Steilabhang hinunter:
Lied anhören
MusicXML-Datei herunterladen
„Wir werden schon ankommen mit dem großen Herrn; wir stehen
in der Reihe und haben keine Angst, unser Essen und unser Geld
vom Serkal, der Regierung, zu bekommen. Wir sind nicht ängstlich;
wir gehen zusammen mit dem großen Herrn, dem Löwen, zur Küste
und kehren zurück.“
In bezug auf den Habitus der verschiedenen Stämme hier auf
dem Westrande des Plateaus komme ich zu keinem anderen
Ergebnis als dem bereits in der Ebene gewonnenen: es ist für einen
Nichtanthropologen unmöglich, es dem einzelnen direkt anzusehen,
welches Stammes er sei. Ich glaube aber, auch für den
Anthropologen von Fach möchte diese Unterscheidung schwer sein,
selbst auf Grund der peinlichsten Untersuchung; die ganze große
Völkergesellschaft hier im Osten des Erdteils, zwischen dem großen
zentralafrikanischen Graben, dem Tanganyika und dem Nyassa im
Westen und dem Indischen Ozean im Osten, ist nun einmal eng
miteinander verwandt; manche ihrer Sprachen unterscheiden sich
nur dialektisch; die Stämme werden zweifellos dieselbe
Schädelbildung und denselben Knochenbau besitzen; von
auffallenden äußeren Stammesunterschieden kann da unmöglich die
Rede sein.
Und selbst wenn sie beständen, hätte ich keine Zeit und Muße,
mich mit ihnen zu befassen, denn welch ungeheure Fülle von
ethnographischen Erscheinungen allein ist es, die Tag für Tag auf
mich einstürmt, die gesehen oder gehört, in beiden Fällen aber
begriffen, aufgezeichnet und niedergeschrieben sein will. Fast
könnte ich es als ein Glück bezeichnen, daß wenigstens einzelne
Forschungsgebiete durch äußere Umstände brachgelegt worden
sind. Da ist vor allem das Gebiet der Eisentechnik. Afrika gilt sonst
als ein Erdteil, wo der Eisenstein sozusagen auf der Straße liegt und
wo es verwunderlich erscheinen möchte, wenn seine Bewohner
nicht zur Verhüttung des überall anstehenden Materials gelangt
wären; tatsächlich reicht ja auch die Kenntnis des Eisenschmelzens
vom Nordrand bis zu den Kaffern.
Hier zwischen Rovuma und Lukuledi liegen die Verhältnisse nicht
so günstig. Raseneisenstein oder eine andere Eisenverbindung ist,
wie die Makonde erzählen, ihnen nicht bekannt; sie und ihre Vettern,
die Wamatambwe, sind demgemäß nicht bis zur Technik des
Eisenschmelzens fortgeschritten, sondern haben seit jeher ihre
Eisengeräte von den Nachbarstämmen kaufen müssen. Aber auch
den Bewohnern des Tieflandes ist es nicht leicht gemacht worden.
Nur ein einziger Fundi, ein alter Mann am Huwe, jenem
steilwandigen Granitklotz, der sich einsam mitten aus der weiten,
grünen Einöde zwischen Massassi und Chingulungulu erhebt und
dessen zackiges, wild zerklüftetes Haupt den Wanderer überall
grüßt, steht im Ruf, als letzter der Lebenden noch die Kunst des
Eisenschmelzens zu bewahren. Schon von Massassi aus wollte ich
den Mann in seiner Tätigkeit studieren; doch da hieß es: er ist aus
Angst vor dem Aufstand über den Rovuma gegangen; er kommt
indes bald wieder. Seitdem habe ich immer wieder gefragt: Ist er
denn nun endlich da, der Fundi? „Bado“, hieß es dann urecht
afrikanisch.

Gelbgießer beim Schmelzen des Messings.


Einen gelinden Trost hat mir dafür ein Gelbgießer gewährt, den
ich im Walde von Akundonde erwischte. Der Mann ist der Liebling

You might also like