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)
Related Posts with twoway connected line graph with multiple if statement
Importance of misspecification test vs. R-sq. and consequences of xtsktestDear Statalist Members, I am analyzing a balanced panel of around 2400 firms over 12 years (Stata 1…
Testing for weak instruments in 2SLS regression using robust SE (just-identified model)Hi, I'am currently struggling to test for weak instruments when conducting a 2sls regression using …
Linear mixed effects models with random effects for subjectI have a dataset of 16 patients with 10 variables. The dependent variable is "bmizpre". It is a long…
Generating a new variable with standardized values compared to a healthy control group mean and SD (z scores)I'm working with crossectional test data with a selection of test results (all continuous variables)…
Esport summary statistics by 5 groupsDear all, Recfently I presented my research project to a faculty. One of the comment for improvemen…
Subscribe to:
Post Comments (Atom)
0 Response to twoway connected line graph with multiple if statement
Post a Comment