SAS Macro Programming Made Easy, 2/e
暫譯: 簡易SAS宏程式設計(第二版)

Michele Burlew

  • 出版商: SAS Press
  • 出版日期: 2007-03-30
  • 售價: $2,040
  • 貴賓價: 9.5$1,938
  • 語言: 英文
  • 頁數: 448
  • 裝訂: Paperback
  • ISBN: 1590478827
  • ISBN-13: 9781590478820
  • 已絕版

買這商品的人也買了...

相關主題

商品描述

Description

Need help understanding the SAS macro facility? You will find all the answers that you need in this easy-to-follow book! Michele Burlew puts her decades of macro programming experience to work for you as she guides you through the basics, as well as the more complex features of the SAS macro facility. Updated extensively for SAS 9, this book includes plenty of examples and step-by-step instructions. You will learn the elements of the macro facility (macro variables, macro programs, macro language), how to write a macro program, macro programming techniques, tips on using the macro facility, how the macro facility fits into SAS, and about the interfaces between the macro facility and other components of SAS.

New topics for the second edition include using SAS 9 macro and SAS language features, debugging macro programs, adding error checking to macro programs, and building a library of utility macro programs.

Beginning macro programmers will learn to write SAS macro programs quickly and efficiently. More experienced macro programmers will find this book useful to refresh their conceptual knowledge and expand on their macro programming skills. It is also important to note that the macro facility is a highly popular part of SAS and found in the job requirements for many SAS programming jobs. In addition, macro facility concepts are tested on the SAS Advanced Programming Exam. The book assumes some SAS programming experience, including knowledge of how to write a DATA step and how to use SAS procedures.

 

Table of 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

Understanding User-Defined Macro Variables   56

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


Conditional Processing with the Macro Language   167

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

商品描述(中文翻譯)

**描述**

需要幫助理解 SAS 宏功能嗎?在這本易於理解的書中,您將找到所需的所有答案!Michele Burlew 利用她數十年的宏程式設計經驗,帶領您了解 SAS 宏功能的基本概念以及更複雜的特性。這本書針對 SAS 9 進行了廣泛更新,包含大量範例和逐步指導。您將學習宏功能的元素(宏變數、宏程式、宏語言)、如何撰寫宏程式、宏程式設計技術、使用宏功能的技巧、宏功能如何融入 SAS 以及宏功能與 SAS 其他組件之間的介面。

第二版的新主題包括使用 SAS 9 宏和 SAS 語言特性、除錯宏程式、為宏程式添加錯誤檢查,以及建立實用宏程式庫。

初學者將能夠快速有效地撰寫 SAS 宏程式。更有經驗的宏程式設計師將發現這本書對於刷新他們的概念知識和擴展宏程式設計技能非常有用。值得注意的是,宏功能是 SAS 中非常受歡迎的部分,並且在許多 SAS 程式設計工作的職位要求中都有提及。此外,宏功能的概念也會在 SAS 高級程式設計考試中進行測試。本書假設讀者具備一定的 SAS 程式設計經驗,包括如何撰寫 DATA 步驟和如何使用 SAS 程序的知識。

**目錄**

前言 ix
致謝 xi

第一部分 理解宏程式設計的概念和特性 1
第 1 章 介紹 3
SAS 宏功能是什麼? 4
SAS 宏功能的優勢是什麼? 6
SAS 宏功能可以在哪裡使用? 12
SAS 宏功能的範例 13

第 2 章 宏處理的機制 23
介紹 23
SAS 處理的詞彙 24
沒有宏活動的 SAS 處理 25
理解標記 26
對 SAS 程式進行標記化 28
比較宏語言處理和 SAS 語言處理 29
處理包含宏語言的 SAS 程式 30

第 3 章 宏變數 39
介紹 40
宏變數的基本概念 40
引用宏變數 42
理解宏變數解析及單引號和雙引號的使用 44
顯示宏變數的值 46
理解自動宏變數 52
理解用戶定義的宏變數 56
將宏變數與文本結合 59
間接引用宏變數 65

第 4 章 宏程式 73
介紹 74
創建宏程式 74
執行宏程式 78
在 SAS 日誌中顯示有關宏程式編譯的註釋 80
在 SAS 日誌中顯示有關宏程式處理的消息 82
通過宏參數將值傳遞給宏程式 85

第 5 章 理解宏符號表及宏程式的處理 101
介紹 102
理解宏符號表 102
宏程式的處理 122

第 6 章 宏語言函數 133
介紹 133
宏字符函數 134
宏評估函數 138
宏引用函數 140
宏變數屬性函數 143
其他宏函數 147
SAS 提供的自動調用宏程式作為函數使用 154

第 7 章