全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2785 7
2013-06-09
%if &dx1 ne %str() %then %do;
.....
%end;
在macro中设置宏变量不为空,大家一直如何写?谢谢!


二维码

扫码加我 拉你入群

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

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

全部回复
2013-6-9 23:12:29
luguo
二维码

扫码加我 拉你入群

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

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

2013-6-10 04:36:49
Not exactly sure what is your question. I think the following example may help you to understand "空" in macro.

%let a=%str( );
%let b=;
%let c=C;

%put >>>&a<<<;
%put >>>&b<<<;
%put >>>&c<<<;
二维码

扫码加我 拉你入群

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

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

2013-6-13 13:32:53
You should mask special characters and mnemonic operators.
%NRBQUOTE is the most useful.
%if %NRBQUOTE(&dx1.) ne %then ....

Ref:SAS 9.2 Macro Language: Reference    Macro Quoting
二维码

扫码加我 拉你入群

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

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

2013-6-13 14:44:01
%macro tt(a=);
   %if &a eq   %then  %put  parameter a is null;
   %else %put  parameter a is "&a";
%mend;

%tt(a=)
%tt(a=a)
二维码

扫码加我 拉你入群

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

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

2013-6-13 14:45:03
bobguy 发表于 2013-6-10 04:36
Not exactly sure what is your question. I think the following example may help you to understand "空 ...
如果是这样呢?

%let a=%str();
%let b=;


%put >>>&a<<<;
%put >>>&b<<<;
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群