Graph builder is turning out to be a great tool that I'm using more and more lately.
I want to show two things simultaneously on this chart, as shown in the attachment:
1. Trend among means of the data (means taken within subgroups, with grouping variable on the x-axis) - with error bars to aid in interpretation.
2. As a further aid to interpretation, I want to show a histogram of the counts within each group, and for this I use a bar chart as shown in the attachment. But this is of course messing up the scale on my primary variable (the one I'm averaging and showing error bars on).
If I could put the bars on a different scale - like a secondary y-axis - that would eliminate this problem I believe. Is there a way to do that?
Well, can't open designer at the moment, but there are xaxis2 and yaxis2 commands available in GTL:
Thanks for the link.
I should have mentioned that the way I'm doing this now is that the graph builder is generated from a JSL script. I'd like to release this tool to users soon so it would be best if I can find a solution that is workable through a JSL script.
Will those commands be available to me in JSL scripting, or do I need to do something else for that?
Sorry, never used that tech. However if you are able to produce graphs using base SAS in any shape or form then these would be available.
You can do that in Graph Builder. The feature is not prominent because it's not a data visualization best practice. See Dual Scaled Axes in Graphs: Are they ever the best solution? for a full discussion; the abbreviated reason is that the overlay suggests a correspondence of scales that usually doesn't exist.
If you still want to proceed, place two or more variables in the Y role in Graph Builder. Then right-click on the Y axis and there will be a contextual menu item called Move Right that let's you pick which variable to move to a right Y axis.
It sounds like that shoudl be a solution if I were talking about two different y variables. I was able to do that I can see what you mean about this not being a best practice for data visualization.
But what I'm trying to do is to show two different aspects of the same y variable. What I am trying to show is the trend in the data with error bars using Mean(points) and standard error for the error bar. Then I want to indicate along the bottom of the x-axis is the count (i.e., N) for that same variable. The chart shows the count within each subgroup bin just as I want it to, but it seems that I cannot make this move to the second axis, since it is not a diifferent variable per se, and thus has a different behavior.