sas宏(3)理解符号表(全局宏与局部宏解析),宏条件运算符,在宏中进行运算
2014-11-29 17:31
453 查看
Understanding the Global Macro Symbol Table
Detail
•The macro processor creates the global macro symbol table at the start of a SAS session.
Four ways to create add macro to Global Macro Table
• Create the macro variable in open code.
• List the macro variable on a %GLOBAL(default value is null) statement in the macro program in which it is defined.
• Create the macro variable in a [b]DATA step with CALL SYMPUTX[/b] when the global symbol table is specified.
• Define a global macro variable with the INTO clause on the PROC SQL SELECT statement.
Where and When they can be used?
You can reference global macro variables throughout the SAS session in which they are created. They can be referenced from open code and from inside macro programs.
EXAMPLE
Understanding the Local Macro Symbol Table
Detail
•If your macro program creates macro variables and does not specify them as global macro variables, the macro processor usually creates a local macro symbol table when that macro program executes,When the macro program finishes, the macro processor deletes the associated local macro symbol table.
Four ways to create add macro to Global Macro Table
• Create the macro variable in open code.
• List the macro variable on a %GLOBAL statement in the macro program in which it is defined.
• Create the macro variable in a [b]DATA step with CALL SYMPUTX[/b] when the global symbol table is specified.
• Define a global macro variable with the INTO clause on the PROC SQL SELECT statement.
Where and When they can be used?
You can reference global macro variables throughout the SAS session in which they are created. They can be referenced from open code and from inside macro programs.
How to Delete
A global macro variable can be deleted by macro language statement %SYMDEL
EXAMPLE
Detail
•The macro processor creates the global macro symbol table at the start of a SAS session.
Four ways to create add macro to Global Macro Table
• Create the macro variable in open code.
• List the macro variable on a %GLOBAL(default value is null) statement in the macro program in which it is defined.
• Create the macro variable in a [b]DATA step with CALL SYMPUTX[/b] when the global symbol table is specified.
• Define a global macro variable with the INTO clause on the PROC SQL SELECT statement.
Where and When they can be used?
You can reference global macro variables throughout the SAS session in which they are created. They can be referenced from open code and from inside macro programs.
EXAMPLE
options symbolgen mprint; /*reference in macro program*/ %let subset=Software; %macro makeds; data temp; set books.ytdsales(where=(section=“&subset”)); attrib qtrsold label='Quarter of Sale'; qtrsold=qtr(datesold); run; %mend makeds; %makeds /*reference in open code*/ proc tabulate data=temp; title “Book Sales Report Produced &sysdate9”; class qtrsold; var saleprice listprice; tables qtrsold all, (saleprice listprice)*(n*f=6. sum*f=dollar12.2) / box=“Section: &subset”; keylabel all='** Total **'; run;
Understanding the Local Macro Symbol Table
Detail
•If your macro program creates macro variables and does not specify them as global macro variables, the macro processor usually creates a local macro symbol table when that macro program executes,When the macro program finishes, the macro processor deletes the associated local macro symbol table.
Four ways to create add macro to Global Macro Table
• Create the macro variable in open code.
• List the macro variable on a %GLOBAL statement in the macro program in which it is defined.
• Create the macro variable in a [b]DATA step with CALL SYMPUTX[/b] when the global symbol table is specified.
• Define a global macro variable with the INTO clause on the PROC SQL SELECT statement.
Where and When they can be used?
You can reference global macro variables throughout the SAS session in which they are created. They can be referenced from open code and from inside macro programs.
How to Delete
A global macro variable can be deleted by macro language statement %SYMDEL
EXAMPLE
相关文章推荐
- linker如何解析多处定义的全局符号【读书摘记】
- js全局变量与局部变量 预解析与作用域链详解
- 我对全局描述符和局部描述符的一些理解
- OpenGL模型变换中局部坐标系和全局坐标系的理解
- 【 c语言中无符号和有符号的加法运算】【深入理解】--【sky原创】
- 链接器解析外部符号的过程 深入理解计算机系统 P475 注:在链接时的注意事项
- OJ题目-使用+-|等符号表示数字,进行运算【C语言】
- 从mount -o一些理解结合cfs进行描述,窥探该项目全局。
- C C++ Java中链接器对全局符号的解析
- python sympy包符号运算进行定积分计算
- Ajax局部刷新div后如何跳出进行全局刷新
- 无符号数进行运算不可能产生负数!
- 转:js全局变量与局部变量 预解析与作用域链详解
- 全局和局部静态变量(static)解析
- 为xml文件创建一个系统内全局的Document对象,供dom4j进行解析和写操作
- (原创)如何进行有符号小数乘法运算?(Verilog)
- 学习OpenGLProgrammingGuide7thEdition有感-OpenGl中的全局及局部坐标系统理解
- opengl中局部坐标和全局坐标之我的理解
- 使用比较运算符号进行比较查询
- JavaScript作用域问题:预解析、全局与局部作用域解析、作用域链