I'm doing a histogram of continuous variable (quallife), discrete by two categories in a binary variable (gender), this is my code (so it looks like two histograms next to each other):

histogram quallife, discrete by(gender)

It produces a nice histogram but I want to relabel the groups so that they don't appear as 1 and 2, but instead as 'male' and 'female'.


I tried this but STATA says 'option relabel not allowed':

histogram quallife, discrete by(gender, relabel(1"Male" 2 "Female"))


I somehow did this correctly at some point but accidentally lost my code and I've been going crazy for days trying to figure out how to do it!

Any help is really appreciated

Thank you