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:
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:
Thank you for your time and consideration.
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 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.