BookmarkSubscribeRSS Feed
Jiordani
Calcite | Level 5

Hello, I want to adjust the bin size on my histogram for the Income variable so a bin will contain data +/1 10,000 or +/- 20,000. I just need it to look like that so it's easier to read and interpret.

 

Here's my code:

sas question 5.png

Focus on the part where it says:

*Make a histogram of median income;
Proc SGPlot data = RegPro.SimplReg;
Histogram Income;
Run;

 

This is my histogram:

sas question 6.png

Thank you for your time and consideration.

1 REPLY 1
ballardw
Super User

I cannot tell what you mean by "a bin will contain data +/1 10,000 or +/- 20,000. " even assuming the +/1 should be read as +/_

 

If you mean the width of a bin should be 10,000 then add the option Binwidth=10000 to the histogram statement. Typically you may also want to specify BINSTART to control the first boundary

 

I might suggest modifying your Histogram to look like:

 

Histogram income/ binstart=40000 binwidth=10000;

Suggestion: Post code with text, copy your text and paste into a text box opened on the forum using the </> icon above the message window. If a recommendation requires lots of code changes you may find that many of us don't want to retype significant amounts of text.

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1 reply
  • 5660 views
  • 0 likes
  • 2 in conversation