Hi Statalist,

I am trying to generate a line graph. I am using four variables. My outcome, which would go on the y axis, is binary for whether an individual is employed or not. The x axis variable is the total number of children. I am trying to graph the percentage of individuals employed at every value of number of children by four groups: mother (of individual) employed, mother unemployed, father employed, father unemployed.

My outcome y axis variable is cremp2, my x axis variable is totalsib and the two variables for the groups are mtempst and ftempst.

I have tried following the advice in this post: https://www.statalist.org/forums/for...alues-by-group ; but without success.


Please see below an example of my dataset

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte cremp2 float totalsib byte(ftempst mtempst) int round
0  3 1 0 2012
0  2 1 0 2018
0  6 1 0 2012
0  7 1 0 2018
1  3 1 0 2012
1  4 0 0 2018
0  3 1 0 2012
0  3 0 0 2018
0  1 1 1 2012
0  2 1 0 2018
0  6 1 0 2012
0  6 1 0 2018
1  3 1 0 2012
0  3 1 0 2018
0  3 1 0 2012
0  3 1 1 2018
0  4 1 0 2012
0  5 1 0 2018
0  5 1 0 2012
0  4 1 0 2018
0  6 1 0 2012
0  3 1 0 2018
0  3 1 0 2012
0  2 1 0 2018
0  5 1 0 2012
0  7 1 0 2018
0  5 1 0 2012
0  4 1 0 2018
0  5 1 0 2012
1  1 0 1 2018
0  5 1 0 2012
0  5 1 0 2018
1  2 1 1 2012
1  2 1 0 2018
0  5 1 0 2012
0  5 1 0 2018
0  8 1 0 2012
1  7 1 0 2018
0  5 1 0 2012
0  4 1 0 2018
0  5 1 1 2012
0  5 1 1 2018
0  3 1 1 2012
0  3 1 1 2018
0  2 1 0 2012
0  2 1 0 2018
0 11 1 0 2012
0 12 1 0 2018
0  5 1 0 2012
1  5 1 0 2018
1  3 1 1 2012
0  3 1 0 2018
0  3 1 0 2012
1  3 1 0 2018
0  5 1 1 2012
0  5 1 0 2018
0  4 1 0 2012
1  4 1 0 2018
0  6 1 0 2012
0  7 1 0 2018
0  3 1 0 2012
1  3 1 0 2018
0  5 1 0 2012
0  5 1 0 2018
0  6 1 0 2012
0  5 1 0 2018
1  5 1 0 2012
1  5 1 0 2018
0  4 1 0 2012
1  4 1 0 2018
0  5 1 0 2012
0  5 0 0 2018
0  2 1 0 2012
0  2 0 0 2018
0  3 1 0 2012
0  4 1 0 2018
0  3 1 0 2012
0  4 1 0 2018
0  5 1 0 2012
0  6 1 0 2018
0  3 1 0 2012
0  5 1 0 2018
0  5 1 0 2012
0  5 1 0 2018
0  6 1 0 2012
0  6 1 0 2018
0  5 1 0 2012
0  5 1 0 2018
0  5 1 0 2012
0  5 1 0 2018
0  4 1 1 2012
0  4 1 1 2018
1  2 1 1 2012
1  2 1 0 2018
1  2 1 0 2012
1  1 1 0 2018
0  4 1 0 2012
0  4 0 0 2018
0  7 1 0 2012
0  7 1 0 2018
end
label values cremp2 emp
label def emp 0 "No", modify
label def emp 1 "Yes", modify
label values ftempst femp
label def femp 0 "Unemployed", modify
label def femp 1 "Employed", modify
label values mtempst memp
label def memp 0 "Unemployed", modify
label def memp 1 "Employed", modify