全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
7055 14
2010-10-07
各位大虾们,下面是我运行朱世武教授书上的程序如下:
%macro create;
data=temp;
set Resdat.&dat end=final;
if year(date)=&year then do;
n+1;
output;
end;
if final then call symput("number",n);
/*创建的宏变量为number,其值为n*/
run;

%mend create;
%macro plot;
proc gplot data=temp;
title2"&pr &year1时序图";
plot &price*date=1;
symbol1 v=star i=join r=1 c=red;
%mend plot;
run;

%macro analyze(getdata,dat,year,pr,price,year1);
%if %upcase(&getdata)=yes %then %create;
footnote "plot of &number of observations";
%plot;
%mend analyze;
run;

%analyze(yes,Idx000001,1999,收盘价,clpr,1999);
%analyze(yes,Idx000002,1999,收盘价,clpr,1999);
%analyze(yes,Idx000001,1999,收盘价,clpr,2000);
%analyze(yes,Idx000002,1999,收盘价,clpr,2000);
run;


在前面编译都非常正常,但
是运行到宏analyse时出错,log上面显示错误如下:

597  %analyze(yes,Idx000001,1999,收盘价,clpr,1999);
WARNING: Apparent symbolic reference NUMBER not resolved.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GPLOT used:
      real time           8.80 seconds
      cpu time            0.01 seconds

ERROR:File WORK.TEMP.DATA does not exist.
WARNING: Apparent symbolic reference YEAR1时序图 not resolved.
WARNING: The TITLE statement is ambiguous due to invalid options or unquoted text.
598  %analyze(yes,Idx000002,1999,收盘价,clpr,1999);
WARNING: Apparent symbolic reference NUMBER not resolved.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GPLOT used:
      real time           0.01 seconds
      cpu time            0.01 seconds

ERROR: File WORK.TEMP.DATA does not exist.
WARNING: Apparent symbolic reference YEAR1时序图 not resolved.
WARNING: The TITLE statement is ambiguous due to invalid options or unquoted text.
599  %analyze(yes,Idx000001,1999,收盘价,clpr,2000);
WARNING: Apparent symbolic reference NUMBER not resolved.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GPLOT used:
      real time           0.01 seconds
      cpu time            0.00 seconds

ERROR: File WORK.TEMP.DATA does not exist.
WARNING: Apparent symbolic reference YEAR1时序图 not resolved.
WARNING: The TITLE statement is ambiguous due to invalid options or unquoted text.
600  %analyze(yes,Idx000002,1999,收盘价,clpr,2000);
WARNING: Apparent symbolic reference NUMBER not resolved.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GPLOT used:
      real time           0.01 seconds
      cpu time            0.00 seconds

ERROR: File WORK.TEMP.DATA does not exist.
WARNING: Apparent symbolic reference YEAR1时序图 not resolved.
WARNING: The TITLE statement is ambiguous due to invalid options or unquoted text.
601  run;
WARNING: RUN statement ignored due to previous errors. Submit QUIT; to terminate the procedure.
二维码

扫码加我 拉你入群

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

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

全部回复
2010-10-7 11:54:55
这是你自己写的还是抄书上的?
data=temp;
=可能是空格
title2"&pr &year1时序图";
全角分号大概是半角分号; macro variable的引用后面是不是少了个点, "&year1.时序图"
%mend plot;
run;
类似的run语句可以不写吧
二维码

扫码加我 拉你入群

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

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

2010-10-7 12:09:17
xiezuosheng 发表于 2010-10-6 20:36
复制代码

这句应该是
复制代码


还有楼上说的前两处也要改正。他说的第三处那个run;是多余的,但不会引起出错。
二维码

扫码加我 拉你入群

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

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

2010-10-7 12:49:51
宏值的比较不需要加引号:)另外你需要学习下宏程序的调试。
二维码

扫码加我 拉你入群

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

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

2010-10-7 18:46:37
o,u open up my eyes@@
二维码

扫码加我 拉你入群

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

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

2010-10-8 11:58:43
太好了,非常感谢各位!
二维码

扫码加我 拉你入群

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

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

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

分享

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