DATA Step, Macro, Functions and more

ensure that two histograms have same bin sizes

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 110
Accepted Solution

ensure that two histograms have same bin sizes

I am using this code:

 

title1 "&Title.";
proc sgplot data=WORK.TempGraphData;
	density X / type=normal lineattrs=(color=red) legendlabel='Bla';
	density Y / type=normal lineattrs=(color=blue) legendlabel='Bla';
	histogram X / transparency=0.75 fillattrs=(color=red) legendlabel='Bla';
	histogram Y / transparency=0.75 fillattrs=(color=blue) legendlabel='Bla';
	keylegend / location=outside position=bottom;
	xaxis label="Normal Curves";
run;

 

but the 2 histograms' bin sizes appear to be very different. can I force the rendering to use the same bin sizes in both diagrams?


Accepted Solutions
Solution
‎02-03-2017 09:34 AM
PROC Star
Posts: 734

Re: ensure that two histograms have same bin sizes

Posted in reply to csetzkorn

Use the binwidth= option as described at the bottom of the blog post here:

 

http://blogs.sas.com/content/iml/2014/08/25/bins-for-histograms.html

 

View solution in original post


All Replies
PROC Star
Posts: 734

Re: ensure that two histograms have same bin sizes

Posted in reply to csetzkorn

you mean the width of the bins right? Smiley Happy

Frequent Contributor
Posts: 110

Re: ensure that two histograms have same bin sizes

yes
Solution
‎02-03-2017 09:34 AM
PROC Star
Posts: 734

Re: ensure that two histograms have same bin sizes

Posted in reply to csetzkorn

Use the binwidth= option as described at the bottom of the blog post here:

 

http://blogs.sas.com/content/iml/2014/08/25/bins-for-histograms.html

 

☑ This topic is solved.

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

Discussion stats
  • 3 replies
  • 159 views
  • 0 likes
  • 2 in conversation