This is nicely illustrative of HPBIN.

But one question is when. if ever, binning is a good idea.

Binning an IV increases type I and type II error and introduces a kind of magical thinking. I wrote a blog post showing, graphically, why this is a bad idea. rapt attention or astonishment at something awesomely mysterious or new to one's experience and Frank Harrell in Regression Modeling Strategies (an excellent book, even if he uses R) lists (I think) 11 problems with this. Better to use splines via ADAPTIVEREG.

Binning a DV causes similar problems.

The only times I'd go for binning is when there is a strong a priori substantive reason for a particular cut point. But then the bins would be predefined.

I know binning is used a lot, so I can see why SAS has a PROC like this, but I think it should be used a lot less.