Hello everyone,
I need to generate the bar graph with dummy variables (for example, the variable "foreign" of the data below). However, I would like to add one more bar with pooled information.
Take the following figure as an example, how could I add one more bar, which pooled "domestic" and "foreign" for each category 1 to 5? Therefore, there should be three bars for each category 1 to 5 (blue bar: domestic; red bar: foreign; yellow bar: pooled as both)

Here is my old code generated the figure above. Thank you very much in advance.
I need to generate the bar graph with dummy variables (for example, the variable "foreign" of the data below). However, I would like to add one more bar with pooled information.
Take the following figure as an example, how could I add one more bar, which pooled "domestic" and "foreign" for each category 1 to 5? Therefore, there should be three bars for each category 1 to 5 (blue bar: domestic; red bar: foreign; yellow bar: pooled as both)
Here is my old code generated the figure above. Thank you very much in advance.
Code:
sysuse auto, clear
graph bar, ///
over(foreign, lab(nolab)) ///
over(rep78) ///
asyvars showyvars ///
graphregion(color(white)) ///
bar(1, fcolor(red) lcolor("grey%45")) ymtick(##2) ///
bar(2, fcolor(blue) lcolor("grey%45")) ymtick(##2) ///
ytitle("Percent", size(small)) ///
ylabel(0(10)30, gmin gmax labsize(small)) yscale(range(0 30)) ///
title(""" ", size(normal)) ///
legend(size(*.5) region(col(white))) name(g1, replace)

Comment