04-07-2017 02:07 PM - last edited on 04-15-2017 01:50 PM by Reeza
How can I create a graph as shown in attachment? and how can I reshape the frame of the graph?
04-07-2017 02:13 PM
PROC SGPLOT for starters but it depends a bit on your data format.
I would use a Scatter statement for the points and a second Scatter statement for the mean.
If you look through the posts on here, I think there was a request for exactly this type of graph in the last week, possibly two weeks.
04-15-2017 01:38 PM
You will not be able to layer a VBOX with SCATTER in SAS 9.2. You need atleast SAS 9.4 for this.
You will need to use the solution shown in the link "http://blogs.sas.com/content/graphicallyspeaking/2017/03/27/scatter-with-layer/", to compute the mean value using the MEANS procedure and then use a plot statement to layer that on the scatter plot (JITTER is also NOT available with SAS 9.2).
However, you cannot use a HighLow plot as that too is not available with SAS 9.2. You will need to use another SCATTER with a different symbol to display the mean value.
SAS 9.2 is over 8 years old. It may be time to consider an upgrade.
04-07-2017 04:49 PM
Here is one way you can do it without any data prep. Of course the "color=white" specification is not going to work for all styles. If you actually want the mean line labeled, you will need additional data prep. Thanks to Prashant for part of this solution.
proc sgplot data=sashelp.class noautolegend;
symbolChar name=longDash char='2014'x / textAttrs=GraphUnicodeText;
vbox weight / category=sex nofill
nomedian meanattrs=(symbol=longdash size=50px)
scatter y=weight x=sex;