全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1238 5
2012-06-27
%macro prtlast;
%if &syslast ne _NULL_ %then %do;
proc print data=&syslast(obs=5);
title "Listing of &syslast data set";
run;
%end;
%else
%put No data set has been created yet.;
%mend;
proc sort data=sasuser.courses out=bydays;
by days;
run;
%prtlast

为什么在Advanced Programming 那本书里面%prtlast后面为什么可以不加分号
二维码

扫码加我 拉你入群

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

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

全部回复
2012-6-28 01:37:31
During execution, macro PRTLAST will be replaced by:
if &syslast ne _NULL_ then do;
proc print data=&syslast(obs=5);
title "Listing of &syslast data set";
run;
end;
else
put No data set has been created yet.;

SO: 可以不加分号. If you did add the semicolon, it doesn't matter. Just like: put No data set has been created yet.;;
二维码

扫码加我 拉你入群

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

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

2012-6-28 02:23:09
You are quoting the macro. So it doesn't matter if there is a ";"
二维码

扫码加我 拉你入群

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

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

2012-6-28 23:11:27
thank you!!
二维码

扫码加我 拉你入群

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

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

2012-6-29 06:53:21
juneandvictor 发表于 2012-6-28 01:37
During execution, macro PRTLAST will be replaced by:
if &syslast ne _NULL_ then do;
proc print dat ...
Sometime it matters but not in this one. Remember ';' is valid statement named null statement.

For example, an additional ';' may end if ... then...;, else if .. then ...; block unintentionally.

Following the language syntaxes or rules will makes program robust.
二维码

扫码加我 拉你入群

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

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

2012-7-4 23:15:17
agree with bobguy
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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