Data visualization with SAS programming

SAS charts

Reply
Occasional Contributor
Posts: 6

SAS charts

[ Edited ]

Hi All

 

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

 

graph.PNGdataset.PNG

PROC Star
Posts: 653

Re: SAS charts

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

Occasional Contributor
Posts: 6

Re: SAS charts

Hi

I have attached the excel file exported from the final dataset
PROC Star
Posts: 653

Re: SAS charts

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

Occasional Contributor
Posts: 6

Re: SAS charts

it is the sum of the rank group by Group_Y_name,proj_r
Occasional Contributor
Posts: 6

Re: SAS charts

Any solution ?
Occasional Contributor
Posts: 6

Re: SAS charts

Can anyone please help its urgent

Community Manager
Posts: 2,889

Re: SAS charts

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

SAS Super FREQ
Posts: 1,141

Re: SAS charts

[ Edited ]

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.

SAS Employee
Posts: 980

Re: SAS charts

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;

Ask a Question
Discussion stats
  • 9 replies
  • 155 views
  • 1 like
  • 5 in conversation