any suggestions on how I can get the group variable on the axis?
(like was available with gchart, using group = and subgroup 😃
Sample code - I'd like the year field to show on the column axis (along with the q field)
data a; input q $ year id $ pct;
cards;
4yr 2013 d 0.44
2yr 2013 d 0.43
4yr 2014 d 0.29
2yr 2014 d 0.63
4yr 2013 i 0.58
2yr 2013 i 0.31
4yr 2014 i 0.54
2yr 2014 i 0.34
;
run;
proc sgpanel data=a noautolegend;
panelby id/columns=2 rows=1;
hbar q / response=pct group =year GROUPDISPLAY=CLUSTER;
run;
Here are some additional ideas. Should work with SGPANEL, but did nto verify.
http://blogs.sas.com/content/graphicallyspeaking/2016/04/08/displaying-group-values-on-axis/
Since you have explicitly turned off the AUTOLEGEND, you can overlay the group value on the bar. If you have SAS 9.4, you can use the TEXT plot. Else, you can use the SCATTER with MARKERCHAR. But to overlay on a bar, you have to use HBARPARM, which is OK since you are not expecting the bar char to summarize data. If you do, you will have to presummarize your data using PROC MEANS, then use HBARPARM.
Note addition of the variable XLBL=0.
data a;
input q $ year id $ pct;
xlbl=0;
cards;
4yr 2013 d 0.44
2yr 2013 d 0.43
4yr 2014 d 0.29
2yr 2014 d 0.63
4yr 2013 i 0.58
2yr 2013 i 0.31
4yr 2014 i 0.54
2yr 2014 i 0.34
;
run;
proc sgpanel data=a noautolegend;
panelby id/columns=2 rows=1;
hbarparm category=q response=pct / group =year GROUPDISPLAY=CLUSTER;
text x=xlbl y=q text=year / group=year groupdisplay=cluster position=right textattrs=(color=black);
colaxis offsetmin=0;
run;
You can creatively put the value anywhere, even rotate it vertically at the base of the bar.
Here are some additional ideas. Should work with SGPANEL, but did nto verify.
http://blogs.sas.com/content/graphicallyspeaking/2016/04/08/displaying-group-values-on-axis/
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.