BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
djrisks
Barite | Level 11

That's great to know that you can see your goal being achievable. I think I know what you are attempting to do. The legend will match the displayed colors on the graphs as long as the index between them are the same. Can you upload the enroll_le dataset and any programs you have created so far, so that I can have a further look?

DavidPhillips2
Rhodochrosite | Level 12

The whole proc is a little long for a proof of concept post.  I can upload part of it once I finish combining the current concepts.

DavidPhillips2
Rhodochrosite | Level 12

http://support.sas.com/resources/papers/proceedings09/324-2009.pdf

http://support.sas.com/kb/43/086.html

The above two links show examples of using uniscale=column and layout to display similar sets of data using two series one on top of the other.  Is it possible to show a second series horizontally using the same method rather than vertically? 

I’ll look at how sgscatter can do this next.

Below is the code I pulled out from it including some dynamic replacements. 

proc sgpanel data=enrollment;           

     panelby residency_desc/ novarname uniscale=column  layout=rowlattice;vbar TWO_DIGIT_YEAR /      response=STUDENTS_ENROLLED stat=sum group=&enrRepTyRank;

           %str(&whereClause);

run;

djrisks
Barite | Level 11

I do not completely understand your question. Will hbar work instead of vbar?

DavidPhillips2
Rhodochrosite | Level 12

The code posted above displays two similar graphs each with their own scale one on top of the other.  Is there a way to use the same functions to display two sets of data right and left of each other? 

The code I posted displays

Series 1 Graph 1

Series 2 Graph 2

I am aiming for

Series 1 Graph 1 Series 2 Graph 2 Series 3 Graph 3 Legend

I know sgscatter can do this for some types of graphs.  I’m not sure if I can use sgscatter to do this and display barcharts with a group clause.


It looks like you can do it according to this SAS documentation.  Although when I try the syntax I do not have a second scale next to the second horizontal graph.


"PANELED PLOTS WITH DIFFERENT DATA RANGES

There might be times when you need to create a panel of plots to convey a complete message about your data, but

the plots in the panel have different data ranges. Both the SGPANEL and SGSCATTER procedures have facilities to

help you create this type of display.

By default, the SGPANEL procedure creates uniform row axes and uniform column axes across all graphs generated

in a run. However, the PANELBY statement contains an option called UNISCALE that enables you turn off the

uniformity of either the row or column axes. By setting the uniform scale for one axis, the range for the other axis is

set to be independent. When used in conjunction with the ROWLATTICE or COLUMNLATTICE layout options, each

plot can have one axis with an independent range.

An example of this technique can be seen in Figure 17. Each test in the blood chemistry and hematology panels has

a different result range. Because the axis is shared within a single row or column (even with the UNISCALE option),

this example uses the ROWLATTICE layout so that there is only one plot per row. For the SAS 9.2 Phase 1 release,

you will need to set the number of rows equal to the number of tests to achieve this result."

http://support.sas.com/resources/papers/proceedings09/324-2009.pdf


DavidPhillips2
Rhodochrosite | Level 12

Wow I tried Hbar instead of Vbar it worked.  Since I can use the series off the bottom of the graph.

djrisks
Barite | Level 11


Great! 🙂

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 21 replies
  • 2527 views
  • 8 likes
  • 5 in conversation