Would be grateful for some advice on how to add an extra layer of code to this existing one below if I wanted to include an additional condition (would it be an if statement?) e.g. show the different lines to indicate Female and Male, or level of education (which is 4 categories). The code shows both genders and I coded gender as a binary variable (female = 0 and male =1). Another graph I want to show is difference in level of education where 0 is no high school, 1 is high school, 2 is undergrad and 3 is postgrad. Thank you.

collapse (mean) Fin_Distress, by(subfin)
twoway connected Fin_Distress subfin, mlabel(Fin_Distress)xlabel(1(1)7) legend(off) plotregion(margin(large)) xtitle(Subjective Knowledge)