BookmarkSubscribeRSS Feed
steve_f
Calcite | Level 5
I am trying to use the sgplot dot procedure to plot a numeric variable against a categorical variable with the dot as the mean and the standard error of the mean as the whisker. I want the y axis to be the numeric variable and the x axis to be the categorical variable but SAS has it the other way. Is there a simple axis statement that I can use to reorient this plot?
3 REPLIES 3
DanH_sas
SAS Super FREQ
Hey Steve,

There is currently not an orient option for the DOT plot, but you can work around this by pre-summarizing the data yourself and using the SCATTER statement in SGPLOT. Here is an example:

[pre]
proc summary data=sashelp.class nway;
class age;
var height;
output out=meandata mean=mean_height lclm=lower uclm=upper;
run;
[/pre]
[pre]
proc sgplot data=meandata;
xaxis grid;
scatter x=age y=mean_height / yerrorupper=upper yerrorlower=lower
markerattrs=(symbol=circlefilled);
run;
[/pre]
steve_f
Calcite | Level 5
Thanks a lot for your help, Dan,

I also want to calculate the 95% confidence interval around a median for the data. I was using proc boxplot where the notches are the 95% confidence interval for the median, but I don't need the interquartile range and whiskers. Do you know of code to suppress everything but the confidence interval? Alternately, I suppose I could simply used the formula in the help information of 1.58 * IQR * n ^ 1/2 similarly to what you suggested for the means.
Steve
GraphGuy
Meteorite | Level 14
If you can't get the boxplot you want using 'proc boxplot' or 'proc gplot' (with interpol=box), etc ... here's an example you might can modify to create your own custom 'boxplot' in whatever way you want (using annotate move/draw commands):

http://robslink.com/SAS/democd47/anno_boxplot.htm

http://robslink.com/SAS/democd47/anno_boxplot_info.htm

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 997 views
  • 0 likes
  • 3 in conversation