BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
pchegoor
Pyrite | Level 9

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,

1 ACCEPTED SOLUTION
7 REPLIES 7
Reeza
Super User

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

 

 

 

pchegoor
Pyrite | Level 9

Hi  Reeza,

 

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

Reeza
Super User

No, include as an image in your main post. 

Or someone else can answer your question. 

pchegoor
Pyrite | Level 9

I  have posted the Image of the graph.

 

Thanks.

pchegoor
Pyrite | Level 9

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

Rick_SAS
SAS Super FREQ

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;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 7 replies
  • 1449 views
  • 0 likes
  • 3 in conversation