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.
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!
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.