Bin a numeric variable into intervals (Stata's egen ... = cut(x), at(...))
Source: R/utils-panel.R
cut_stata.RdAssigns each value of x to the half-open interval [at[i], at[i+1]) it
falls in, labelling it with the interval's lower bound. The final
breakpoint is exclusive: values equal to or beyond it (and values below the
first breakpoint) return NA, matching Stata's cut() egen function.