How can I create a graph as shown in attachment? and how can I reshape the frame of the graph?
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.
Sir,
I am working on SAS 9.2. This solution is not working. Can you give me a better solution.
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.
ooooh
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)
whiskerattrs=(thickness=0) lineattrs=(color=white);
scatter y=weight x=sex;
run;
possibly lineattrs=(thickness=0) to not display a line, background color independent.
this is not working for me (SAS 9.2)
Please post your full program with data and log messages. Just saying "It is not working" is not very meaningful.
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.