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

Hi!

I would like to create a graph as follow by using the groupdisplay tag.

Is this possible and how?

furniture_example.png

And if I change gtl tag to barchart would this be possible?

Documentation info can be found here:

http://support.sas.com/documentation/cdl/en/grstatgraph/65377/HTML/default/viewer.htm#p0dcix1s0khu6f...

Thanks in advance,

Best regards

Paolo Santin

1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

NEEDLEPLOT does not allow stacked groups.  The only benefit I see of using needle instead of barchartis that you can have an interval X axis, since bar chart always makes the axis discrete.  If that is your aim, you can use the HIGHLOWPLOT with default TYPE=LINE.  You will have to compute the high and low values yourself based on the stacking you want.  You can also use the HIGHLOWBAR with TYPE=BAR with a linear axis.  This will give you the "bar" look with fills and outlines, but these type of plot (HighLowPlot or NeedlePlot) do not summarize your data.  You can also do this in SGPLOT.

Another alternative is to use the VECTORPLOT.

View solution in original post

4 REPLIES 4
Jay54
Meteorite | Level 14


Yes, you can do this using GTL BARCHART.  The bar chart can have only ONE group role which can either be Clustered or Stacked.  So in your case split your data into two response columns, one for the "1" data and one for the "2" data.  Then, use a stacked bar chart.for the "1" values with a negative discrete offset.  Overlay another stacked bar chart for the "2" with positive discrete offset.  Set bar widths to 0.5 or less.

paolo_santin
Calcite | Level 5

Hi Sanjay and thank you for your answer!

I wonder if it's possible to do the same thing with the needleplot tag instead.

I should use the groupdisplay option but I couldn't make it work.

Do you know how to obtain such a result?

Thank you in advance!

Br,

Paolo

Jay54
Meteorite | Level 14

NEEDLEPLOT does not allow stacked groups.  The only benefit I see of using needle instead of barchartis that you can have an interval X axis, since bar chart always makes the axis discrete.  If that is your aim, you can use the HIGHLOWPLOT with default TYPE=LINE.  You will have to compute the high and low values yourself based on the stacking you want.  You can also use the HIGHLOWBAR with TYPE=BAR with a linear axis.  This will give you the "bar" look with fills and outlines, but these type of plot (HighLowPlot or NeedlePlot) do not summarize your data.  You can also do this in SGPLOT.

Another alternative is to use the VECTORPLOT.

paolo_santin
Calcite | Level 5

Thank you very much!

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 1553 views
  • 3 likes
  • 2 in conversation