楼主: saslovime
16960 5

[原创博文] 求助 %str的功能 [推广有奖]

  • 0关注
  • 0粉丝

小学生

7%

还不是VIP/贵宾

-

威望
0
论坛币
49 个
通用积分
0.0600
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
228 点
帖子
11
精华
0
在线时间
6 小时
注册时间
2009-8-19
最后登录
2010-3-15

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
当一个sas程序中出现这样的赋值语句:sourceSubset=%str(1=1),右边这个%str(1=1)作何解释呀?(注,sourceSubset为一个宏函数的默认参数)。

请高手赐教!!
二维码

扫码加我 拉你入群

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

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

关键词:sources Subset Source sas程序 subs 程序

回帖推荐

waitalone11 发表于4楼  查看完整内容

%str就是为了让一些类似等号的特殊符号可以解析。

jingju11 发表于2楼  查看完整内容

1# saslovime Quote the string ‘1=1’ at macro compile time. Without quoting, the string may be resolved in an unexpected way at some cases, even I did not see what the quotation exactly functions here.

本帖被以下文库推荐

沙发
jingju11 发表于 2010-1-21 22:28:01 |只看作者 |坛友微信交流群
1# saslovime

%str(1=1)
Quote the string ‘1=1’ at macro compile time. Without quoting, the string may be resolved in an unexpected way at some cases, even I did not see what the quotation exactly functions here.
已有 2 人评分经验 论坛币 收起 理由
eijuhz + 20 精彩帖子
bakoll + 3 + 3 精彩帖子

总评分: 经验 + 23  论坛币 + 3   查看全部评分

使用道具

藤椅
bobguy 发表于 2010-1-22 09:20:46 |只看作者 |坛友微信交流群
jingju11 发表于 2010-1-21 22:28
1# saslovime

%str(1=1)
Quote the string ‘1=1’ at macro compile time. Without quoting, the string may be resolved in an unexpected way at some cases, even I did not see what the quotation exactly functions here.
You are right.

But it still seems to the %str here is redundant because (1=1) is a legitimate expression with no 'confusion'.


145  data _null_;
146    sourceSubset=1;
147    if sourceSubset=%str(1=1) then put '1';
148    else put '0';
149    run;

1
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


150
151    %macro t(d);
152       %let  sourceSubset=1;
153       %if &sourceSubset=%str(1=1) %then %put >>>1;
154       %else %put >>>0;
155    %mend;
156
157    %t(d);
>>>0

使用道具

板凳
waitalone11 发表于 2010-1-22 09:32:41 |只看作者 |坛友微信交流群
%str就是为了让一些类似等号的特殊符号可以解析。
已有 3 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
eijuhz + 20 精彩帖子
zhou-jinxiang + 1 + 1 + 1 热心帮助其他会员
bakoll + 3 + 3 精彩帖子

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

使用道具

报纸
crackman 发表于 2010-5-21 23:42:01 |只看作者 |坛友微信交流群
学习了

使用道具

地板
cz851218 发表于 2010-5-24 13:53:11 |只看作者 |坛友微信交流群
%str是屏蔽掉一些特殊的符号:如( ,),%等;上面的程序是返回一个逻辑表达式的值
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
zhou-jinxiang + 1 + 1 + 1 我很赞同

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

使用道具

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

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

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

GMT+8, 2024-5-9 20:11