在sgplot系列curvelabel中解析宏变量

时间:2015-01-14 03:09:18

标签: graph sas

%let MTDAvg = 33.3;

proc sgplot data=mydata ;
vbarparm category=Day response=Sale1 / group=Dow barwidth=0.7 nooutline datalabel dataskin=pressed name="Daily"; 
series x=Day y=Sale2 / lineattrs=(color=grey pattern=solid thickness=1.5) name="Weekly" ;
series x=Day y=Sale3 / lineattrs=(color=red pattern=solid thickness=2) curvelabel='Avg:%cmpres(&MTDAvg)';
keylegend "Daily" / position=topright noborder autoitemsize;
xaxis display=(nolabel) offsetmax=0.08 labelattrs=(color=pab size=0.5); 
yaxis grid min=10 max=55;
inset 'Avg:%cmpres(&MTDAvg)' / noborder position=topright;
run;

使用上面的代码,inset语句会将Avg:33.3放在右上角。 但curvelabel无法解析宏变量,并在系列'Avg:%cmpres(&MTDAvg)的末尾返回series x=Day y=Sale3

1 个答案:

答案 0 :(得分:1)

看起来这可能是一个简单的修复,您需要围绕宏变量",而不是'