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
SAS Super FREQ
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

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
  • 7 replies
  • 1117 views
  • 0 likes
  • 5 in conversation