SAS macro High-Level Knowledge points

1. As a macro function, you do not need to enclose character values in quotation marks as you do in DATA step functions.

  One way in which macro language is different from SAS language is Macro-variable values are always text, quotation marks are not needed to indicate texr constants in the macro language.

  EXAMPLE

     dsid=open("sasuser.houses","i");                /*has quotation marks, because it‘s a DATA step function*/
     dsid=open("&mydata","&mode");
     %let dsid = %sysfunc(open(sasuser.houses,i));  /*has not quatation marks, becauese it‘s a macro funtion*/
     %let dsid=%sysfunc(open(&mydata,&mode));

2. the compile and execute process of sas program

  step-1: Submitted SAS programs start in the input stack.

  step-2: The word scanner takes statements from the input stack and tokenizes the statements into the fundamental units of words and symbols.

  step-3: The word scanner then direct the tokens to the DATA step compiler, macro processor, command processor or SCL compiler

  step-4: The compiler or processor that receives the tokens checks for synatax errors,if none are found, the step executes.

3.Understanding Tokens

  The fundamental building blocks of a SAS program are the tokens that the word scanner creates from your SAS language statements. Each word, literal string, number, and special symbol in the statement in your program is a token.

  The word scanner determines that a token ends when either a blank is found following a token or when another token begins. The maximum of a token unber SAS is 32767 characters.

  Two special symbol tokens, when followed by either a letter or underscore, signal the word scanner to turn processing over to the macro processor. These two characters, the ampersand (&) and the percent sign (%), are called macro triggers. 

   

The interactive between Macro-Language Processing and SAS-language Processing

  When the word scanner detects a macro trigger followed by a name token, it sends what follows to the macro processor and temporarily turn processing over the macro processor. The word scanner suspends tokenization while the macro processor completes its job. Therefore, processing of a macro language reference occurs after tokenization and before compilation.

  1. As your SAS programming assistant, the macro processor codes SAS language statements for you based on the guidelines you give it.

  2. The macro processor take the macro language statements you write and send non-macro text, such as SAS language statements, back to the input stack.

  3. The macro processor puts the non-macro text that it builds back on the top of the input stack.

  4. The word scanner then resumes its work by tokenizing the non-macro text it received from the macro processor.

  

时间: 2025-01-11 13:25:26

SAS macro High-Level Knowledge points的相关文章

confusing knowledge points

在电子学领域里,带宽是用来描述频带宽度的.但是在数字传输方面,也常用带宽来衡量传输数据的能力.用它来表示单位时间内(一般以“秒”为单位)传输数据容量的大小,表示吞吐数据的能力.这也意味着,宽的带宽每秒钟可以传输更多的数据.所以我们一般也将“带宽”称为“数据传输率”. 带宽的单位一般有两种表现形式: 第一种是B/s.KB/s或MB/s,表示单位时间(秒)内传输的数据量(字节.千字节.兆字节): 第二种是bps(或称b/s).Kbps(或称Kb/s)或Mbps(或称Mb/s),表示单位时间(秒)内传

Oracle!你必须要知道的Knowledge points(入门篇)

一.入门 oracle有四个用户,分别为sys.system.sysman和scott,其中sys是oracle权限最高的用户,类似于Linux 系统的root,scott是实例用户,上课就以这个用户里的三张员工表empno.dept.salgrade作为示例来授课. 启动服务 1. 快捷键ctrl+alt+del打开任务管理器 2. 选择服务 3. 启动OracleServiceXXXX(XXXX是全局名字)和oracleXXXXXXXListener服务(选中一个按o快速找到哦) 这个非常重

Oracle!你必须要知道的Knowledge points(下)

子查询 什么是子查询 当查询中的限制条件需要另一个查询提供时,我们可以把两个查询语句嵌套起来,提供条件的查询语句作为子查询.子查询,也叫内部查询,先于主查询执行,子查询的结果被用于主查询.子查询分为单行子查询.多行子查询和多列子查询,单行子查询作为判断条件时用单行运算符,多行子查询和多列子查询作为判断条件时用多行运算符.单行运算符:>.=.>=.<.<>.<=多行运算符:in.all.any 子查询可以嵌套在哪里 Where子句:作为非分组函数筛选判断的条件From子句

sas宏(1)、系统宏变量、自定义宏变量、输出宏值、大量实用宏函数、宏与text结合

SAS macro variables enable you to substitute text in your SAS programs(替代作用,和c++的 #define 差不多) When you reference a macro variable in a SAS program, SAS replaces the reference with the text value that has been assigned to that macro variable. By subs

SaS学习资源收集

目前手里的电子书(2018-08-15 00:24) SAS Programming ISAS Programming IISAS Programming IIIdon't be a SAS dinosaur Modernize Your SAS ProgramsSAS_Certification_Prep_Guide_-_Base_Programming_for_SAS_9,_4th_EditioneThe Little SAS Book A Primer, Fifth Edition 5th

全面解析《嵌入式程序员应该知道的16个问题》

文章为转载文章,写的很好,和大家分享下,原文连接如下: ----Sailor_forever分析整理,[email protected] http://blog.csdn.net/sailor_8318/archive/2008/03/25/2215041.aspx 1.预处理器(Preprocessor) 2.如何定义宏 3.预处理器标识#error的目的是什么? 4.死循环(Infinite loops) 5.数据声明(Data declarations) 6.关键字static的作用是什么

【转】嵌入式程序员应该知道的16个问题

全面解析<嵌入式程序员应该知道的16个问题> ----Sailor_forever分析整理,[email protected] http://blog.csdn.net/sailor_8318/archive/2008/03/25/2215041.aspx 1.预处理器(Preprocessor) 2.如何定义宏 3.预处理器标识#error的目的是什么? 4.死循环(Infinite loops) 5.数据声明(Data declarations) 6.关键字static的作用是什么? 7.

C++ Core Guidelines

C++ Core Guidelines September 9, 2015 Editors: Bjarne Stroustrup Herb Sutter This document is a very early draft. It is inkorrekt, incompleat, and pµøoorly formatted. Had it been an open source (code) project, this would have been release 0.6. Copy

嵌入式相关5

嵌入式常用定义整理 简述常见的嵌入式存储器和特点(4种以上). ROM.SRAM.DRAM. 根据掉电数据是否丢失,存储器可以分为RAM(随机存取器)和ROM(只读存储器),其中RAM的访问速度比较快,但掉电后数据会丢失,而ROM掉电后数据不会丢失.人们通常所说的内存即指系统中的RAM. RAM又可分为SRAM(静态存储器)和DRAM(动态存储器) SRAM是利用双稳态触发器来保存信息的,只要不掉电,信息是不会丢失的. DRAM是利用MOS(金属氧化物半导体)电容存储电荷来储存信息的,因此必须通