Hi,
I am attempting to use sgplot to generate a boxplot using vbox that also displays two horizontal reference lines across the page, but where the reference lines cross the box, I would like the lines to be invisible. Using my code (show below), the references lines are visible where they cross the box and I am not sure which options are available to allow me to hide the parts of the reference lines that occupy the same space as the box. I tried playing around with the "transparency" option in different places without success.
Thanks
ods listing gpath='C:\Output' image_dpi=600;
ods graphics on/reset=all border=off imagefmt=tiff imagename='My plot';
proc sgplot data=data_x;
vbox yvar/boxwidth=0.15 fill fillattrs=(color=white) meanattrs=(symbol=plus size=8) outlierattrs=(symbol=circle size=5);
refline 96 98/axis=y lineattrs=(pattern=20 color=black);
yaxis label="my label" labelattrs=(size=14) valueattrs=(size=13) minor minorcount=1;
run;
quit;
ods graphics off;
Reference lines are like plots - the order in which they are specified is important. The first plot statement is drawn first, and the next one top of that. To fix your issue, specify the REFLINE statement before the VBOX.
Reference lines are like plots - the order in which they are specified is important. The first plot statement is drawn first, and the next one top of that. To fix your issue, specify the REFLINE statement before the VBOX.
Thanks!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.