Data visualization with SAS programming

How is this Graph produced via GCHART and SGPLOT

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 89
Accepted Solution

How is this Graph produced via GCHART and SGPLOT

[ Edited ]

Sample.pngCan   Someone  please let me know  how  the  attached  Stacked Horizontal Bar graph was  produced  using  GCHART  Procedure?  I  found  this  Sample graph online  a couple of years  ago but  do  not know  how  this was produced at that time. It is  Obviously using  SASHELP.CLASS  dataset.

 

Also  can this  easily be produced via  SGPLOT too?  I am using  SAS 9.4M3.

 

Thanks,


Accepted Solutions
Solution
‎11-21-2016 08:14 PM
SAS Super FREQ
Posts: 3,630

Re: How is this Graph produced via GCHART and SGPLOT


All Replies
Super User
Posts: 19,167

Re: How is this Graph produced via GCHART and SGPLOT

Your PDF isn't displaying but here's a link to the Graph Gallery,

https://support.sas.com/sassamples/graphgallery/PROC_GCHART_Graph_Types_Charts_Bar.html

 

 

 

Frequent Contributor
Posts: 89

Re: How is this Graph produced via GCHART and SGPLOT

Hi  Reeza,

 

The PDF  should  be displaying.   Are  you able to download   it  and then  view?

Super User
Posts: 19,167

Re: How is this Graph produced via GCHART and SGPLOT

No, include as an image in your main post. 

Or someone else can answer your question. 

Frequent Contributor
Posts: 89

Re: How is this Graph produced via GCHART and SGPLOT

I  have posted the Image of the graph.

 

Thanks.

Solution
‎11-21-2016 08:14 PM
SAS Super FREQ
Posts: 3,630

Re: How is this Graph produced via GCHART and SGPLOT

Here is a link to the original thread that featured this image:

https://communities.sas.com/t5/SASware-Ballot-Ideas/SGPLOT-SGPANEL-Graph-Template-Language-GTL-Provi...

 

Frequent Contributor
Posts: 89

Re: How is this Graph produced via GCHART and SGPLOT

[ Edited ]

Thanks  @Rick_SAS .It looks like  this Graph is easier using  GCHART than SGPLOT.

SAS Super FREQ
Posts: 3,630

Re: How is this Graph produced via GCHART and SGPLOT

What is "easy" depend on the individual. If you find GCHART easier, that's fine. Personally, I don't think it is too hard to run a data step to find the center of each block and then use the TEXT statement to plot the names:

 

proc sort data=sashelp.class out=class;
by age;
run;

data class;
set class;
by age;
if first.age  then cumheight = height/2;
else cumHeight + height;
run;

proc sgplot data=class noautolegend;
hbarbasic age / response=height group=name groupdisplay=stack;
text y=age x=cumHeight text=name;
run;

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 357 views
  • 0 likes
  • 3 in conversation