Hello,
I would like to draw a histogram of one interval variable in SAS that also would present a mean of another variable in the bin of the histogram. I'm attaching a pdf to give you an idea what I would like to get.
Regards,
DarekB
Hello @DarekB and welcome to the SAS Support Communities,
You could create an overlay chart as is described here: https://blogs.sas.com/content/graphicallyspeaking/2018/02/05/dual-response-axis-bar-line-overlay-par...
This blog (Graphically Speaking) presents a great variety of plots that can be produced with SAS ODS Graphics.
Thank you very much @FreelanceReinh.
I have one question. Instead of a bar plot with categories I would like to have a histogram of an interval variable drawn by SAS and then a line on the histogram
It seems that more advanced techniques (PROC TEMPLATE) are required to overlay a curve on a histogram:
https://blogs.sas.com/content/iml/2013/04/24/overlay-density-curve-on-a-histogram.html.
I'm not really familiar with PROC TEMPLATE. So, if I were to produce that graph, I would consider creating a bar chart based on the histogram data. For example, if you create the original histogram with PROC UNIVARIATE, you can write the histogram data to a dataset:
A histogram is a bar chart with no spaces between the bars. Add that option to the blog posts and it's essentially the same thing.
@DarekB wrote:
Thank you very much @FreelanceReinh.
I have one question. Instead of a bar plot with categories I would like to have a histogram of an interval variable drawn by SAS and then a line on the histogram
@Reeza My understanding is that to have a histogram you have to calculate bins (categories) based on the interval variable sample distribution. Then you draw a bar plot with calculated bins as categories.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.