I want to plot connected line graph to represent the before after pattern of a policy implemented in 2014.
I want to see the trend of gender(a dummy variable, male==0, female==1) in the expansionary state(which is another indicator variable, expansionary state==1 vs non expansionary state==0). So this is a nested if condition.
How do i incorporate this two conditions to plot a two way connected graph for the gender in the expansionary state?

My current code is the following which is giving an error as "invalid syntax"
by year gender, sort: egen mean_enroll=mean(enrollment)
twoway (connected mean_enroll year if gender==1, ms(O)) (connected mean_enroll year if gender==0, ms(Oh)), xline(2014) legend(label(1 "Female") label(2 "Male")) , by(expansionary_state)