Hello
I'm having some challenges in making a twoway line graph that has a criterion. Y variable = a respondents score in a survey (q2_score). X variable = when the respondent answered the survey ("hour"). The criterion i want is to show it based on different demographics like gender and age. I've looked into it and this is the options i've tried:
graph twoway (line q2_score hour) if gender == 1 --> 1 = man. When i submit this i get exactly the same line graph i would get if i just typed "graph twoway (line q2_score hour)".
I also typed the code:
graph twoway (line q2_score hour), by gender. This gives me the two line graphs next to eachother by gender, but the line graphs are unchanged, or just the same as if i would type "(line q2_score hour)" as shown below.

Anyone know how to fix this such that the graphs are based on the criterion/criteria?
My other option is to make datasets based exclusively on the different ranges of age and one for man and one for woman, but there are also other parameters i would like to use as criterions, and i really hope there is an easier way to do it than to make 10's of different datasets.
Tor
I'm having some challenges in making a twoway line graph that has a criterion. Y variable = a respondents score in a survey (q2_score). X variable = when the respondent answered the survey ("hour"). The criterion i want is to show it based on different demographics like gender and age. I've looked into it and this is the options i've tried:
graph twoway (line q2_score hour) if gender == 1 --> 1 = man. When i submit this i get exactly the same line graph i would get if i just typed "graph twoway (line q2_score hour)".
I also typed the code:
graph twoway (line q2_score hour), by gender. This gives me the two line graphs next to eachother by gender, but the line graphs are unchanged, or just the same as if i would type "(line q2_score hour)" as shown below.
Anyone know how to fix this such that the graphs are based on the criterion/criteria?
My other option is to make datasets based exclusively on the different ranges of age and one for man and one for woman, but there are also other parameters i would like to use as criterions, and i really hope there is an easier way to do it than to make 10's of different datasets.
Tor
Comment