楼主: Bookseek
1900 2

[学习分享] SAS 9.4 Macro Language [推广有奖]

  • 0关注
  • 0粉丝

等待验证会员

高中生

5%

还不是VIP/贵宾

-

威望
0
论坛币
1214 个
通用积分
0.0600
学术水平
1 点
热心指数
1 点
信用等级
1 点
经验
196 点
帖子
8
精华
0
在线时间
21 小时
注册时间
2016-6-20
最后登录
2018-11-14

相似文件 换一批

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

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


二维码

扫码加我 拉你入群

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

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

关键词:Language Macro lang acr Age

SAS? 9.4 Macro Language Reference.pdf

3.5 MB

需要: 10 个论坛币  [购买]

SAS 9.4 Macro Language

已有 1 人评分经验 学术水平 热心指数 信用等级 收起 理由
accumulation + 100 + 1 + 1 + 1 精彩帖子

总评分: 经验 + 100  学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

本帖被以下文库推荐

沙发
8112mmw 发表于 2016-6-28 07:57:51 |只看作者 |坛友微信交流群
英文版,有点吃力啊!

使用道具

藤椅
麦弥 发表于 2016-6-28 09:45:42 |只看作者 |坛友微信交流群
这本书网上可以找到免费的,楼主还收那么多论坛币

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-25 13:47