我不用宏命令的话,代码如下没有错误:
data plant;
infile'C:\Users\Administrator\Desktop\final\plants.txt';
length fn$13 ln$15;
input fn$ ln$ x y;
if fn='cornus' and ln='florida';
file'E:\sas\sasdata\plants.txt';
put fn ln x y;run;
proc freq;
table x*y;
symbol value=asterisk cv=red;
proc gplot;
plot y*x;
title'cornus florida';
run;
可是我用宏之后,出现报错,代码如下
%macro two(name1,name2,val=,color=);
if fn='&name1' and ln='&name2';
file'E:\sas\sasdata\plants.txt';
put fn ln x y;run;
proc freq;
table x*y;
symbol value=&val cv=&color;
proc gplot;
plot y*x;
title"&name1 &name2";
run;
%mend;
data plant;
infile'C:\Users\Administrator\Desktop\final\plants.txt';
length fn$13 ln$15;
input fn$ ln$ x y;
%two(cornus, florida,val=asterisk,color=red);
run;
一直显示不了结果,log里面没有红色显示,但是说没有观测值。
我想问下各位前辈,这是怎么。