BookmarkSubscribeRSS Feed
PoisonSAS
Calcite | Level 5

Hi All

 

I need output as in the graph below from the attached dataset

 

graph.PNGdataset.PNG

9 REPLIES 9
PeterClemmensen
Tourmaline | Level 20

Post your data in the form of a datastep if you want a code answer 🙂

PoisonSAS
Calcite | Level 5
Hi

I have attached the excel file exported from the final dataset
PeterClemmensen
Tourmaline | Level 20

And what do the numbers 3, 3, 4, 4 under GY1 represent?

PoisonSAS
Calcite | Level 5
it is the sum of the rank group by Group_Y_name,proj_r
PoisonSAS
Calcite | Level 5
Any solution ?
PoisonSAS
Calcite | Level 5

Can anyone please help its urgent

ChrisHemedinger
Community Manager

You might glean some advice from this blog post about "G100" from @Jay54.

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
Jay54
Meteorite | Level 14

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.

GraphGuy
Meteorite | Level 14

Here's one way to do it, using Proc GChart ...

 

grouped_bar.png

 

 

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 9 replies
  • 1865 views
  • 1 like
  • 5 in conversation