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

Hi Everyone,

 

I am trying to create some basic histograms using proc sgpanel and I am having trouble with the binwidth and binstart options. On some of the graphs I create, one panel will not follow the width and starting point specified. For example, I have four panels on a graph, three of which start at the point identified (1.25) with binstart and have the appropriate width (2.5), but the last one has widths twice as big (5) and starts at a different point (0). 

 

Code:

proc sgpanel data = subjectlevel;
	panelby class;
	histogram score/ binwidth = 2.5 binstart = 1.25;
	colaxis values = (0 to 50 by 5);
run;	

graph.png

 

Is there any way to fix this problem?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
bemiller
Fluorite | Level 6

I fixed it by adding 0.0001 to my binwidth. so my code went from

proc sgpanel data = subjectlevel;
panelby class;
histogram score/ binwidth = 2.5 binstart = 1.25;
colaxis values = (0 to 50 by 5);
run;

to 

proc sgpanel data = subjectlevel;
 panelby class;
 histogram score/ binwidth = 2.5001 binstart = 1.25;
 colaxis values = (0 to 50 by 5);
run;

...

View solution in original post

3 REPLIES 3
ballardw
Super User

You might look at the actual values of your score variable for the fourth value of the panelby variable.

 

I suspect some combination of values and intervals between values of the score variable are causing a problem.

bemiller
Fluorite | Level 6

For all of the groups, the scores are whole numbers, and the fourth group specifically has 10% of the data from 0-2 (so where the first bin should be).

bemiller
Fluorite | Level 6

I fixed it by adding 0.0001 to my binwidth. so my code went from

proc sgpanel data = subjectlevel;
panelby class;
histogram score/ binwidth = 2.5 binstart = 1.25;
colaxis values = (0 to 50 by 5);
run;

to 

proc sgpanel data = subjectlevel;
 panelby class;
 histogram score/ binwidth = 2.5001 binstart = 1.25;
 colaxis values = (0 to 50 by 5);
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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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