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
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.