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
}
}
Related Posts with Bar Graph with loop
Replace with value from another observation?Hi Statalist! I am so please to be on board this great list that I have often used with great pleas…
Generating age variable in pannel datasetHello Everyone! I was wondering if you could assist me in generating an age variable in a panel dat…
Difference-in- model and data structureDear all, I have a question about the difference-in-difference (DID) model and its data structure. M…
Generating advanced variable in Stata (panel data)Hi all, I am working with a panel data set (Orbis by Bureau van Dijk) containing information on mill…
Variable selection in survival analysesHi All, I have clinical trial data, and my goal is to build a predictive model. In logistic analyse…
Subscribe to:
Post Comments (Atom)
0 Response to Bar Graph with loop
Post a Comment