Hi All
I need output as in the graph below from the attached dataset
Post your data in the form of a datastep if you want a code answer 🙂
And what do the numbers 3, 3, 4, 4 under GY1 represent?
Can anyone please help its urgent
You might glean some advice from this blog post about "G100" from @Jay54.
This looks like a "Likert" graph, vertical instead of horizontal. You can likely modify the examples in the blog articles. See the code linked at the bottom of the articles. Use a VBARPARM instead of the HBARPARM. Flip the options on the x & y axes.
https://blogs.sas.com/content/graphicallyspeaking/2016/08/01/likert-graph-revisited/
https://blogs.sas.com/content/graphicallyspeaking/2014/10/30/likert-graphs/
Suggestion by Chris will also likely work. If you have SAS release 9.4M3 or higher, you can use the SEGLABEL option (5th graph) to display the segment values in the bar segments.
Here's one way to do it, using Proc GChart ...
PROC IMPORT OUT=my_data DATAFILE="final.xls"
DBMS=XLS REPLACE;
GETNAMES=YES;
RUN;
proc sql;
create table my_data as
select unique *, sum(c) as sum_c
from my_data
group by group_y_name, proj_r;
quit; run;
data my_data; set my_data;
format c_pct percent7.0;
c_pct=c/sum_c;
run;
proc format;
value rankfmt
1 = "1st Ranked"
2 = "2nd Ranked"
3 = "3rd Ranked"
;
run;
pattern1 v=s c=cxfad9b8;
pattern2 v=s c=cxadd8e6;
pattern3 v=s c=cxf9f9cf;
axis1 style=0 label=none major=none minor=none value=none offset=(0,0);
axis2 label=none;
axis3 label=none;
legend1 label=none;
goptions ftext='albany amt/bold' htext=11pt ctext=gray33 htitle=14pt;
title1 ls=1.5 "Proof-of-Concept Bar Chart";
proc gchart data=my_data;
format ranking rankfmt.;
vbar proj_r / discrete type=sum sumvar=c_pct space=0
group=group_y_name
subgroup=ranking inside=sum
raxis=axis1 noframe legend=legend1
maxis=axis2 gaxis=axis3
coutline=white gspace=5;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.