Publisher: SAS Publishing
Number Of Pages: 248
Publication Date: 2007-07-26
Sales Rank: 1305992
ISBN / ASIN: 1590475747
EAN: 9781590475744
Binding: Textbook Binding
Manufacturer: SAS Publishing
Studio: SAS Publishing
Get the most from your SAS software! In this expert collection of strategic and tactical solutions, author Philip Holland shows you how to save time and money by making the most of your SAS software. You'll gain a deeper knowledge of your existing SAS components, improve your coding efficiency, and learn how to develop applications that are easier to maintain. Filled with invaluable tips and hints and with coding examples that can be adapted to your specific projects, this book is the ultimate reference source that you will reach for again and again as you develop your business processes. You'll learn how to perform many tasks, including the following: access SAS data by using the SAS ODBC Driver, DDE, and SAS Integration Technologies make productive use of available space in mainframe, Windows, and UNIX environments produce portable graphic report formats by using SAS/GRAPH® import data from and export data to external databases and spreadsheets without using SAS/ACCESS read specific data types from flat files into SAS data sets develop SAS applications by using SAS Enterprise Guide Whether you're a beginner or an advanced SAS programmer, this guide will increase your understanding of SAS and help you get the full value from your SAS software!
Contents
Preface ix
Acknowledgments xi
Part 1 Understanding the Concepts and Features of
Macro Programming 1
Chapter 1 Introduction 3
What Is the SAS Macro Facility? 4
What Are the Advantages of the SAS Macro Facility? 6
Where Can the SAS Macro Facility Be Used? 12
Examples of the SAS Macro Facility 13
Chapter 2 Mechanics of Macro Processing 23
Introduction 23
The Vocabulary of SAS Processing 24
SAS Processing without Macro Activity 25
Understanding Tokens 26
Tokenizing a SAS Program 28
Comparing Macro Language Processing and SAS Language
Processing 29
Processing a SAS Program That Contains Macro Language 30
Chapter 3 Macro Variables 39
Introduction 40
Basic Concepts of Macro Variables 40
Referencing Macro Variables 42
Understanding Macro Variable Resolution and the Use of Single and
Double Quotation Marks 44
Displaying Macro Variable Values 46
Understanding Automatic Macro Variables 52
Combining Macro Variables with Text 59
Referencing Macro Variables Indirectly 65
Chapter 4 Macro Programs 73
Introduction 74
Creating Macro Programs 74
Executing a Macro Program 78
Displaying Notes about Macro Program Compilation in the
SAS Log 80
Displaying Messages about Macro Program Processing in the
SAS Log 82
Passing Values to a Macro Program through Macro Parameters 85
Chapter 5 Understanding Macro Symbol Tables and the
Processing of Macro Programs 101
Introduction 102
Understanding Macro Symbol Tables 102
Processing of Macro Programs 122
Chapter 6 Macro Language Functions 133
Introduction 133
Macro Character Functions 134
Macro Evaluation Functions 138
Macro Quoting Functions 140
Macro Variable Attribute Functions 143
Other Macro Functions 147
SAS Supplied Autocall Macro Programs Used Like Functions 154
Chapter 7 Macro Expressions and Macro Programming
Statements 159
Introduction 160
Macro Language Statements 160
Constructing Macro Expressions 163
Iterative Processing with the Macro Language 177
Branching in Macro Processing 184
Chapter 8 Masking Special Characters and Mnemonic
Operators 189
Introduction 190
Why Are Quoting Functions Called Quoting Functions? 191
Illustrating the Need for Macro Quoting Functions 191
Describing the Commonly Used Macro Quoting Functions 192
Understanding How Macro Quoting Functions Work 194
Applying Macro Quoting Functions 195
Specifying Macro Program Parameters That Contain Special
Characters or Mnemonic Operators 203
Unmasking Text and the %UNQUOTE Function 213
Using Quoting Versions of Macro Character Functions and Autocall
Macro Programs 214
Chapter 9 Interfaces to the Macro Facility 217
Introduction 218
Understanding DATA Step Interfaces to the Macro Facility 218
Using Macro Facility Features in PROC SQL 251
Using Macro Facility Features in SAS Component Language 262
Part 2 Applying Your Knowledge of Macro
Programming 267
Chapter 10 Storing and Reusing Macro Programs 269
Introduction 270
Saving Macro Programs with the Autocall Facility 270
Saving Macro Programs with the Stored Compiled Macro
Facility 278
Resolving Macro Program References When Using the Autocall
Facility and the Stored Compiled Macro Facility 283
Chapter 11 Building a Library of Utilities 285
Introduction 285
Writing a Macro Program to Behave Like a Function 286
Programming Routine Tasks 290
Chapter 12 Debugging Macro Programming and Adding Error
Checking to Macro Programs 297
Introduction 298
Understanding the Types of Errors That Can Occur in Macro
Programming 298
Minimizing Errors in Developing SAS Programs That Contain Macro
Language 299
Categorizing and Checking for Common Problems in Macro
Programming 299
Understanding the Tools That Can Debug Macro Programming 303
Examples of Solving Errors in Macro Programming 307
Improving Your Macro Programming by Including Error
Checking 326
Chapter 13 A Stepwise Method for Writing Macro Programs 335
Introduction 336
Building a Macro Program in Four Steps 336
Applying the Four Steps to an Example 337
Part 3 Appendixes 369
Appendix A Abridged Macro Language Reference 371
Selected SAS Options Used with the Macro Facility 372
Automatic Macro Variables 373
Macro Functions 377
Macro Language Statements 381
PROC SQL Interface to the Macro Facility 386
SAS Functions and Routines That Interface with the Macro
Facility 387
Appendix B Reserved Words in the Macro Facility 391
Appendix C Sample Data Set 393
Appendix D Reference to Programs in This Book 399
Index 407
|