Hi,

I want to create a bar graph for multiple variables and combine them in a graph using a loop. But my code only generates a bar graph for the first variable. How can I adjust my code to fix this problem?

My code is:

foreach var of varlist merge1 merge2 merge3 {
foreach var of varlist Beschäftigungsanteil_1 Beschäftigungsanteil_2 Beschäftigungsanteil_3 Beschäftigungsanteil_4 {
graph bar, over (ˋvar') saving (Stellendaten2, replace)
graph bar, over (ˋvar') saving (BHP2, replace)
graph bar, over (ˋvar') saving (Beide2, replace)
graph combine Stellendaten2.gph BHP2.gph Beide2.gph, xcommon ycommon rows(1)
graph export ˋvar'bar.png
}
}