1. %str 和 %nrstr %str(character-string)%nrstr(character-string) 这两个函数属于 Macro quoting function, 作用是:在宏编译时,当存在特殊字符影响到宏编译的结果时,将其放入这两个函数中就可以掩盖这些字符。可以掩盖的字符有: 除此之外,%NRSTR 还可以掩盖 & 和 % . 注意:如果是不成对的引号或括号,...
2. Quoting function的类型 可以依照作用时间将上述quoting function分成两类:compliation function和execution function。前者的mask作用发生在编译期间,后者发生在运行期间。关于编译和运行的概念,这里不深入讨论了,仅提供一个例子: %macro getMaxVal(indata, invar); /* returns maxium value of a variable from a d...
Quoting Function主要是用于屏蔽一些字符的特定功能,将其作为普通的字符来对待。例如:运算符、比较符、操作符灯,还有两个Macro Trigger:%,&。 这部分共包含有12个函数,分别是:%STR、%NRSTR、%QUOTE、%NRQUOTE、%BQUOTE、%NRBQUOTE、%SUPERQ、%UNQUOTE、%QSAN、%QSUBSTR、%QSYSFUNC、%QUPCASE。 其中后4个函数...
在本例中%superq(&client)会返回错误。 关于Quoting Function的例子大概就讲这么多了。从这些例子中,可以看到一旦宏变量被任一quoting function作用之后,再次引用该宏变量就无需再次使用quoting function了。这表明,屏蔽的作用是持续的,这一点我们也多次在例子中利用SASHELP.VMACRO证明了(屏蔽作用实际上是以字符替代的...
Macro系列文章,将会逐一奉上SAS Macro的点点滴滴,带你踏上从认识Macro到熟练使用Macro之路。掌握SAS Macro,将会使你的SAS编程能力更上一层楼。 上 期 上期文章“Macro Quoting ”这一主题进行了介绍。在每种编程语言中都有一些字符具有特殊的含义,但是在某些情况下我们不需要他们有特殊的含义,只是单纯的当作一个字...
Macro Function wih Quoting 具有Quoting功能的函数:%QSCAN、%QSUBSTR、%QSYSFUNC、%QUPCASE。这些具有Quoting功能的函数,能够隐藏返回结果中的特殊字符的功能。具体来说,可以隐藏以下特殊字符: %QUOTE和%NRQUOTE %STR(包括%NRSTR)只在程序编译的阶段起作用;在程序执行阶段是不起作用的。而%QUOTE函数(相对应的还有...
Because %STR masks parentheses without a match, the macro processor does not recognize the arguments of a function or the parameter values of a macro invocation. For a description of quoting in SAS macro language, see Macro Quoting.Note: The maximum level of nesting for macro quoting functio...
%STR The most commonly used macro quoting function is %STR. Often it is used along with the %LET statement to mask semicolons that would otherwise terminate the %LET. In the following example we want to create a macro variable &P that contains two SAS statements; %LET P=PROC PRINT ...
Tell us...How satisfied are you with SAS documentation? Thank you for your feedback. Please choose a rating. How satisfied are you with SAS documentation overall? Very Dissatisfied Dissatisfied Neither dissatisfied or satisfied (OR neutral) Satisfied...
The most important effect of %UNQUOTE is to restore normal tokenization of a value whose tokenization was altered by a previous macro quoting function. %UNQUOTE takes effect during macro execution. For more information, see Macro Quoting.Example: Using %UNQUOTE to Unmask Values This example ...