如何将标题设为" var1 = e和var = b",假设它是重复过程(不能硬编码)。
data test1;
input y x var1$ var2$ key$;
datalines;
1 2 e b eb
2 4 e b eb
3 6 e b eb
4 1 e b eb
5 2 e b eb
6 3 e b eb
;
run;
proc sgplot data=test1 ;
series x=x y=y ;
title "I cannot make the title dynamic";
run;
答案 0 :(得分:0)
特殊标题标记#BYVAR<n>
和#BYVAL<n>
被第n个变量名替换,它是当前的分组值。此替换在作为产生输出的过程中by
组处理的一部分自动发生。
此示例演示如何关闭默认的by-lines并使用特殊标记在输出标题中生成所需的叙述。
data cars;
Wheels = 4;
set sashelp.cars;
run;
options nobyline;
title "#byvar1=#byval1 and #byvar2=#byval2";
proc sgplot data=cars;
by wheels make;
vbar model / response=horsepower nostatlabel;
run;
options byline;
title;
答案 1 :(得分:-1)
将VAR1和VAR2的值读入宏中,然后在标题中使用该宏。
proc sql noprint;
select var1, var2
into :var1 trimmed, :var2 trimmed
from test1(obs=1);
quit;
proc sgplot data=test1 ;
series x=x y=y ;
title "VAR1=&var1 and VAR2=&var2";
run;