# NOT RUN {
x <- egen(infert, age)
tab(x, age_cat)
# }
# NOT RUN {
## Set cut-off points
x <- egen(infert, age, c(26, 31, 36, 41))
tab(x, age_cat)
## Add labels and give a new name
x <- egen(infert, age, c(26, 31, 36, 41),
lbl = c("<= 25", "26 - 30", "31 - 35",
"36 - 40", "41+"),
new_var = age_grp)
tab(x, age_grp)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab