Hi there,
I'm looking for a way to tune this PROC SGPLOT produced graph. I don't mind changing to a different procedure while the result remains the same.
Thanks in advance for all your help and comments!!
It is hard to say what your x-axis range is as you have turned the axis off. If the axis is numeric 1-6, then you could set the values=(1 to 4 by 1). Or, you can reduce the min and max offsets.
For the highlighting, place a "X" reference line behind the box plot with x value ='Global', and increase the line thickness. Use transparency and color you want.
proc sgplot data=sashelp.heart;
refline 'Coronary Heart Disease' / axis=x
lineattrs=(thickness=70 color=yellow) transparency=0.5 ;
vbox cholesterol / category=deathcause;
run;
It is hard to say what your x-axis range is as you have turned the axis off. If the axis is numeric 1-6, then you could set the values=(1 to 4 by 1). Or, you can reduce the min and max offsets.
For the highlighting, place a "X" reference line behind the box plot with x value ='Global', and increase the line thickness. Use transparency and color you want.
proc sgplot data=sashelp.heart;
refline 'Coronary Heart Disease' / axis=x
lineattrs=(thickness=70 color=yellow) transparency=0.5 ;
vbox cholesterol / category=deathcause;
run;
Thanks a lot @Jay54 for your help!!
The offset attribute wasn't working for me because it just moves the the plot towards one side or another, but you gave me a clue on where to search for a proper solution. I finally solved it changing the THRESHOLDMIN and THRESHOLDMAX values, which control the spacing between the left and right border of the plot respectively.
About the line reference, it totally solved my problem in a very simple way. Thanks for such an ingenious solution!!
Thanks again!!
You are welcome. For future reference, it is easier to help if you attach your code and some sample data. Then we can see what you are getting and how to help. Version of SAS also helps.
The RefLine thickness will impact the offsets. You can set the offsetmin and offsetmax to control the white space.
proc sgplot data=sashelp.heart;
refline 'Coronary Heart Disease' / axis=x
lineattrs=(thickness=70 color=yellow) transparency=0.5 ;
vbox cholesterol / category=deathcause;
yaxis offsetmin=0.05 offsetmax=0.05;
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.