sas宏(3)理解符号表(全局宏与局部宏解析),宏条件运算符,在宏中进行运算

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 DATA step with CALL SYMPUTX 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 DATA step with CALL SYMPUTX 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 

 

转载于:https://www.cnblogs.com/yican/p/4109376.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
数据分析,数据科学及AI算法是当前最热门的职业。这些职业有着共同的特点:面向数字的,针对编程的以及采取分析手段的。 这些当代热点特性使得在就业市场上对以上职位需求激增也就不足为奇了。但是,市场上提供这方面的大型综合的培训课程是有限,如果说有,大多是知识范围狭窄且非综合性的,而且大多培训都缺乏方法论与实务结合。一般的情况是讲师讲述某种语言的一堆代码,学生听完后甚至连使用方法及代码的前提都不清楚,更别提实际应用场景了。这里,掌握一门数据分析软件本身没错,但仅通过单一的编程培训很难获得聘用为数据分析师或数据科学家所需的技能。那我的解决方案是什么呢?首先,我把所有数据分析中的典型问题都归类总结出来,再结合相应的实际问题,数据以及案例,同时采用世界上最流行的两种数据分析软件:PYTHON 和 SAS去解决这些问题,并将这些解决方法传授给学生。学生在完成培训后更重要的收获是知道每一问题从产生直至解决的前因后果和应用场景,这是因为我在每一课程章节最前都会交代方法论,知识要点及应用场合。SAS和PYTHON可以一起学吗?当然可以。因为我就是这样做到的。具体步骤是,我在课程当中安排了一系列主题,然后使用两种编程语言解决同样的问题。我总结出这样做的好处是边学习边比较,最后在不知不觉当中掌握了两门语言的精华和数据分析的通用方法或模式。过程虽有点长,但十分有趣。最后,为了巩固已学的知识和技能,我还专门安排了针对PYTHON 和 SAS的中小型项目及详细代码讲解。另外,课程当中使用的全部编程代码及数据文件都将免费地提供给注册的学生。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值