BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jack2012
Obsidian | Level 7
Please help me figure out how to create below figure via GTL, thanks.
GraphQ.png
1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

Unfortunately, we do not have support for multi-header layouts at this time. However, your age group variable fall into a natural cluster grouping scenario. Have you tried putting "agegroup" as the group variable and "drug description" on the lattice?

 

Thanks!
Dan

View solution in original post

7 REPLIES 7
RW9
Diamond | Level 26 RW9
Diamond | Level 26

It looks like a multi-panel bargraph to me.  You will find examples on pretty much every graph over here including code:

http://blogs.sas.com/content/graphicallyspeaking/

 

For instance:

http://blogs.sas.com/content/graphicallyspeaking/?s=panel

Reeza
Super User

What version of SAS?

Cynthia_sas
Diamond | Level 26
Hi:
I'm not sure you need GTL, it looks like SGPANEL output to me. What code have you tried?
cynthia
DanH_sas
SAS Super FREQ

If a may make a suggestion, try taking the variable you used for the panel row (agegroup ?) and make it the grouping variable for the bar chart. I think it would make your comparisons in the chart easier to read.

 

To accomplish this with PROC SGPANEL, you code will look something like this:

 

proc sgpanel data=outcome;

panelby sequence treatment / layout=lattice onpanel novarname;

vbar outcome / response=count group=agegroup groupdisplay=cluster; /* not sure of what stat you need */

run;

 

Hope this helps!

Dan

Jack2012
Obsidian | Level 7

Thanks for your code. But I can only get below with each cell contains two formulation results. I know this is due to we use the Lattice alyout. What I am seeking is is there possibility to add two levels in the header and with each row for one age group? Just like my sample figure in the first post.

 

Thanks.

SGPanel2.png

DanH_sas
SAS Super FREQ

Unfortunately, we do not have support for multi-header layouts at this time. However, your age group variable fall into a natural cluster grouping scenario. Have you tried putting "agegroup" as the group variable and "drug description" on the lattice?

 

Thanks!
Dan

Jack2012
Obsidian | Level 7

I have got your point. That is the one I am seeking.

I think I can try merge the two headers into one.

 

Best

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2109 views
  • 0 likes
  • 5 in conversation