Hi guys,

I just meet an interesting problem. My boss asked me to recode a continuous variable, for example, age.
The final goal is to cut the age into some intervals which maximizing the difference of wage among the intervals.
I just wonder that are there any user-written command which can automatically do that?

I found some information on the web, there are some algorithms called "chi2 algorithm" which can compare the distribution of adjacent intervals to combine some trivial intervals.
Any similar command in stata?