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.

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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