我希望在SGPANEL图中为每个面板添加不同的水平参考线。我目前只能在0.83
处有一条参考线proc sgpanel data=TEMP;
panelby AvPatRef / layout=panel columns=3;
format patcorr_order corrformatnum.;
label AvPatRef = 'Average Patient Refusal';
where AvClinRef=0;
refline 0.83 / lineattrs=(thickness=2);
series y=PowerPPLogF x=patcorr_order / legendlabel='PP' markers markerattrs=(symbol=circle) lineattrs=(pattern=1);
series y=PowerITTLogF x=patcorr_order / legendlabel='ITT' markers markerattrs=(symbol=plus) lineattrs=(pattern=1);
series y=PowerSPSLogF x=patcorr_order / legendlabel='2SPS' markers markerattrs=(symbol=diamond) lineattrs=(pattern=1);
series y=PowerSRILogF x=patcorr_order / legendlabel='2SRI' markers markerattrs=(symbol=triangle) lineattrs=(pattern=1);
colaxis discreteorder=unformatted values = (1 to 4 by 1) label='Correlation between baseline CVD risk and refusal probability';
rowaxis grid values = (0.4 to 1.0 by 0.02) label='Power';
run;
ods listing close;
感谢您的帮助。
祝福,
亚历
答案 0 :(得分:2)
您可以将变量指定为参考线而不是常量。例如,请考虑您的面板数据集是否如此:
have
_________________
x y panel_group
1 2 A
3 4 A
5 6 B
7 8 B
假设对于A,您需要y=2
处的参考线,而对于B,您需要y=6
处的参考线。您可以创建一个包含这些值的新变量:
data want;
set have;
if(panel_group = 'A') then ref_val = 2;
else ref_val = 6;
run;
您的数据集现在每个面板都有不同的参考值:
want
_________________________
x y panel_group ref_val
1 2 A 2
3 4 A 2
5 6 B 6
7 8 B 6
您可以在ref_val
声明中直接引用refline
:
proc sgpanel data=want;
panelby panel_group;
series x = x y = y;
refline ref_val;
run;
我希望这有帮助!