In 9.2 when there are too many values of the categorical variable for a dot plot to display, then it thins them out. I thought for sure that there was an option in SAS 9.3 that forced all of the values to be displayed, but I can't find it. Was I dreaming that? Can someone point me to the option, please?
Thanks for the response. Sure, it might help people to see what I'm talking about. Here's example code, but take any dotplot where there are too many categorical values to fit on the vertical axis.
proc sgplot data=sashelp.cars;
You'll see right off the bat that Acura and BMW are not shown on the vertical axis. The procedure is THINning the values on the axis. I thought for the life of me that there was an option to show all the values, in this case the MAKE's of the cars. Of course, now I can't find it. Maybe it doesn't exist.
On the X axis you can specify a FITPOLICY to improve things. This is not available on the Y axis. To see all the values, you may decrease the font size of the tick values, as in :
proc sgplot data=sashelp.cars;
Well, I'll pick this as a helpful answer in case others come here because of the title, and I certainly appreciate the effort in trying to solve the problem. Thank you very much.
However, I don't think I was clear enough in stating the problem. I know the other work arounds to the problem, I was trying to determine if the developers had incorporated a feature that handled it automatically. It was a "Yes, it's ____" or "No, you're crazy" type of answer. I'll be giving a HOW at SGF and if that option is there, then I wanted to note that. I was told there was, I thought I saw it, but now I can't find it. My conclusion is that I am crazy, at least slightly.
The work arounds provided are okay, but they're not great. They run into the same problem that I think a built-in option would have, which is the same problem the default behavior is trying to solve. When there's that many values to the categorical variable, there's just not enough space to show them all well. Both of the options PGStats gives change the space needed (font size option) relative to the space available (height). Both of those, and I suspect almost every solution, make it difficult to read the values when you fit the plot into a typically-sized space.
Thinking some more about it, I wonder if there's a way to put the "other" categorical values, in this case "Acura" and "BMW" on the Y2AXIS? Nothing comes to mind right off, though maybe with GTL. Doing so would reduce the horizontal space now. It may be too much if the values are long on both sides, such as "Mercedes-Benz," but maybe not. I'll see what I can figure out.
If anyone has suggestions on how to put the extra values on the Y2AXIS, then I'm open.
Thanks again everyone.
Last but not least, you may have the option to split your data onto multiple graphs:
ods graphics / reset;
proc sort data=sashelp.cars out=cars; by origin; run;
proc sgplot data=cars uniform=xscale;
If there's not a good way with SGplot, perhaps a work-around would be to use GPlot ?
The traditional SAS/Graph procs tend to scrunch the axis tickmark values closer together (even to the point of overlapping), rather than thinning them. - ie, they give the user exactly what they ask for and let the user look at it and manually decide if they need to take action and do it differently.
create table foo as
select unique make, count(*) as count
group by make
order by make;
symbol value=dot height=1 color=black;
proc gplot data=foo;
plot make*count=1 / autovref cvref=graydd;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.