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.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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