Sometimes you need to split a variable into groups. There are several ways to achieve this in Stata, in this post we'll use the egen command. egen stands for extensions to generate and is used mainly for more advanced operations than can be handled with the gen command. We'll look more at the egen command in another post.
Using the nlsw88 training dataset we'll split the wage variable in 3 groups, like so:
sysuse nlsw88, clear
egen wage_group = cut(wage), group(3)
tab wage_group
Here we generated a variable wage_group consisting of three roughly equally sized groups of wage.