I use Stata 16.1 and I'm trying to make bar charts for two different groups.
The first group is a binary variable that accounts for language (0 for German and 1 for French) called lang.
The second group is a binary variable as well that accounts for the conjuction of language and whether the individual works in the public sector (0 for German speaker AND public worker; 1 for French speaker AND public worker). This variable is called pub_lang; missing values are for people that work in the private sector - which I'm not interested in.
To create this variable, I used this code
Code:
g pub_lang=. replace pub_lang=1 if public==1 & lang==1 replace pub_lang=0 if public==1 & lang==0
Here is a subset of my database:
input byte gtrust float(lang pub_lang)
5 1 .
3 1 .
3 1 .
6 1 .
0 1 .
5 1 .
. 1 .
. 1 .
6 1 1
. 1 .
8 1 1
6 1 1
6 1 1
4 1 1
. 1 .
. 1 .
. 1 .
6 1 .
. 1 .
4 1 .
6 1 1
4 1 .
7 1 .
5 1 .
5 1 .
7 1 .
. 1 .
. 1 .
6 1 .
7 1 .
3 1 .
5 1 .
4 1 .
. 1 .
4 1 .
5 1 1
5 1 1
5 1 1
5 1 1
. 0 .
7 0 0
. 0 0
8 0 0
. 0 .
8 1 .
8 1 .
8 1 .
8 1 .
I use the following code:
Code:
graph bar (mean) gtrust, over(lang) over(pub_lang)
Does anyone know what's going on? I suspect that it's because of pub_lang being a compound variable, but not sure.
Thank you.
0 Response to By group bar charts only displaying results for one type of observations within each group
Post a Comment