Hi All,
I'm analyzing some survey data and want to present some data in a horizontal bar chart. The data is in terms of agreement, neutral or disagreement. I can get the data in the chart but not in the order I'd like.
I would like to have the Questions order by the Agree %, so the topic that most people agree with is at the top of the charts. Second I would like the 'bars' within the questions arranged from Agree to Neutral to Disagree. I could drop the Disagree without changing the appearance, but thought I'd leave it in for now.
I'm using a sample for Rob Allisons page.
Here's what I have so far.
Thanks!
[pre]
data have;
input question $ agreement $ percent;
cards;
Q1 Agree 0.25
Q1 Neutral 0.30
Q1 Disagree 0.45
Q2 Agree 0.55
Q2 Neutral 0.10
Q2 Disagree 0.35
Q3 Agree 0.45
Q3 Neutral 0.25
Q3 Disagree 0.3
;
run;
proc sort data=have; by agreement descending percent; run;
goptions gunit=pct htitle=4 ftitle="albany amt/bold" htext=2 ftext="albany amt";
axis1 label=none;
axis2 label=none order=(0 to 1 by .1) minor=(number=1) offset=(0,0) value=(h=3pct);
legend1 label=none position=(bottom)
shape=bar(3,3) across=3;
/* pattern v=solid color=red; */
pattern1 v=solid color=cxbd0026; /* kind of a seafoam green */
pattern2 v=solid color=cxc7e9b4; /* this is the hex rgb color for mild blue */
pattern3 v=solid color=cx43a2ca; /* reddish color */
title1 "Percent Agreement";
proc gchart data=have;
hbar question / discrete
type=sum sumvar=percent
subgroup=agreement/* this controls the coloring */
nostats
maxis=axis1 /* midpoint axis */
raxis=axis2 /* response/numeric axis */
autoref /* reflines at every major axis tickmark */
legend=legend1
coutline=same
;
run;
quit;
[/pre]
... View more