set have;
select (question);
when('Q2') question=' Q2' ;
when( 'Q3') question= ' Q3';
when( 'Q1') qwestion='Q1';
otherwise;
end;
select (agreement);
when('Agree') agreement=' Agree' ;
when('Neutral') agreement= ' Neutral';
when('Disagree') agreement='Disagree' ;
otherwise;
end;
run;
goptions gunit=pct htitle=4 ftitle="
amt/bold" htext=2 ftext="
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]
[/pre]
Ksharp
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.