- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello, I would like to create a graph like below with mean and SD by category AND to this graph I would like to add actual data points( which was used to calculate means and SD) in each category. for e.g if 5 data points were used to calculate mean for category AAA I would like to show those 5 points as dots vertically for a category. Can you please suggest how to do this? Appreciate any help.Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I found this resource, but the sample code in the sample dataset do not produce the result. Also it has min and max points but not all data points.
http://support.sas.com/kb/24/871.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Visual Analytics does not use Proc Gchart at all and I'm not sure of any of the other graphing procedures as the interface is quite restrictive. So general searches that do not include VA aren't going to find solutions.
I had a non-VA example but from a certain amount of experience attempting to answer questions with Visual Analytics other approaches in general do not work as you have to work through the menus.
Not a graph like you want but the menu items he points to in this article, https://communities.sas.com/t5/SAS-Communities-Library/3-steps-to-building-a-monthly-temperature-str... , may give you some places to start poking around.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It does not need to be a VA solution.
I found a code that is trying to do similar thing except dont include data points in the chart but this example code do not give the said result.
http://support.sas.com/kb/47/076.html
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
A general programming solution that should work outside of Visual Analytics:
proc summary data=sashelp.class nway; class sex; var weight; output out=work.summary (drop= _: ) mean= lclm= uclm= / autoname; run; data work.plot; set sashelp.class work.summary ; run; proc sgplot data=work.plot; vbarparm category=sex response=weight_mean/ limitlower=weight_lclm limitupper= weight_uclm ; scatter x=sex y=weight ; run;
Some note that are needed:
There are limits of which types of plots in Proc Sgplot can overlay. To have a scatter plot and bar plot you must summarize the data to create the bar and the VBARPARM or HBARPARM. So that is why I summarize the data that will be used to create the scatter plot (SASHELP.CLASS). You should have this data set as part of your install. The Proc Summary calculates the mean and upper and lower confidence limits of the mean. You can change the default 95% confidence limits by adding the ALPHA= parameter to the proc statement. The / autoname option creates output variable names by appending the statistic to the variable name after an underscore character.
The summarized data and the base data have to be in a single set and the X axis variable has to be the same for plots to overlay correctly. For a VBAR type plot the X axis variable is called Category.
There are lots of options available to modify the appearance of plot elements. I suggest looking into the syntax references.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
In general, if you're graphing with SAS, SGPLOT and GTL should be your starting point these days. SAS GRAPH is pretty outdated at this point and the graphical options and display is much better in SG procedures.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Instead of using a SCATTER overlay, you might want to consider using an AXISTABLE:
proc sgplot data=sashelp.class;
vbar age / response=weight stat=mean limitstat=stddev;
xaxistable age / stat=freq location=inside;
run;