全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2220 2
2016-06-27

Content

Chapter 1 • Introduction to the Macro Facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Getting Started with the Macro Facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Replacing Text Strings Using Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Generating SAS Code Using Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

More Advanced Macro Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

Other Features of the Macro Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Chapter 2 • SAS Programs and Macro Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

SAS Programs and Macro Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

How SAS Processes Statements without Macro Activity . . . . . . . . . . . . . . . . . . . . . . . 14

How SAS Processes Statements with Macro Activity . . . . . . . . . . . . . . . . . . . . . . . . . . 16

Chapter 3 • Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

Macro Variables Defined by the Macro Processor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

Macro Variables Defined by Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

Using Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

Displaying Macro Variable Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

Referencing Macro Variables Indirectly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

Manipulating Macro Variable Values with Macro Functions . . . . . . . . . . . . . . . . . . . . . 35

Chapter 4 • Macro Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

Macro Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

Defining and Calling Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

How the Macro Processor Compiles a Macro Definition . . . . . . . . . . . . . . . . . . . . . . . . 38

How the Macro Processor Executes a Compiled Macro . . . . . . . . . . . . . . . . . . . . . . . . 40

Summary of Macro Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

Chapter 5 • Scopes of Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

Scopes of Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

Global Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

Local Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

Writing the Contents of Symbol Tables to the SAS Log . . . . . . . . . . . . . . . . . . . . . . . . 51

How Macro Variables Are Assigned and Resolved . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

Examples of Macro Variable Scopes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

Special Cases of Scope with the CALL SYMPUT Routine . . . . . . . . . . . . . . . . . . . . . . 63

Chapter 6 • Macro Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

Macro Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

Defining Arithmetic and Logical Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

How the Macro Processor Evaluates Arithmetic Expressions . . . . . . . . . . . . . . . . . . . . 74

How the Macro Processor Evaluates Logical Expressions . . . . . . . . . . . . . . . . . . . . . . . 76

Chapter 7 • Macro Quoting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

Macro Quoting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

Deciding When to Use a Macro Quoting Function and Which Function to Use . . . . . . 83

%STR and %NRSTR Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

%BQUOTE and %NRBQUOTE Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

Referring to Already Quoted Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

Deciding How Much Text to Mask with a Macro Quoting Function . . . . . . . . . . . . . . . 90

%SUPERQ Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

Summary of Macro Quoting Functions and the Characters That They Mask . . . . . . . . 94

Unquoting Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

How Macro Quoting Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

Other Functions That Perform Macro Quoting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

Chapter 8 • Interfaces with the Macro Facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

Interfaces with the Macro Facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

DATA Step Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102

Using SAS Language Functions in the DATA Step and Macro Facility . . . . . . . . . . . 106

Interfaces with the SQL Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107

Interfaces with the SAS Component Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

SAS/CONNECT Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

Chapter 9 • Storing and Reusing Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

Storing and Reusing Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

Saving Macros in an Autocall Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

Saving Macros Using the Stored Compiled Macro Facility . . . . . . . . . . . . . . . . . . . . . 117

Chapter 10 • Macro Facility Error Messages and Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

General Macro Debugging Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

Troubleshooting Your Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

Debugging Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

Chapter 11 • Writing Efficient and Portable Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

Writing Efficient and Portable Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

Keeping Efficiency in Perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

Writing Efficient Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

Writing Portable Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

Chapter 12 • Macro Language Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

Macro Language Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

Macro Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

Macro Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

Automatic Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164

Interfaces with the Macro Facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

Selected Autocall Macros Provided with SAS Software . . . . . . . . . . . . . . . . . . . . . . . 169

Selected System Options Used in the Macro Facility . . . . . . . . . . . . . . . . . . . . . . . . . 171

PART 2Macro Language Dictionary175

Chapter 13 • AutoCall Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

AutoCall Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

Chapter 14 • Automatic Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195

Automatic Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196

iv Contents

Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196

Chapter 15 • DATA Step Call Routines for Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

DATA Step Call Routines for Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

Chapter 16 • DATA Step Functions for Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243

DATA Step Functions for Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243

Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243

Chapter 17 • Macro Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253

Macro Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253

Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254

Chapter 18 • SQL Clauses for Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291

SQL Clauses for Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291

Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291

Chapter 19 • Macro Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295

Macro Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295

Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296

Chapter 20 • System Options for Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343

System Options for Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343

Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344

PART


附件列表

SAS? 9.4 Macro Language Reference.pdf

大小:3.5 MB

只需: 10 个论坛币  马上下载

SAS 9.4 Macro Language

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2016-6-28 07:57:51
英文版,有点吃力啊!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-6-28 09:45:42
这本书网上可以找到免费的,楼主还收那么多论坛币
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群