Hello,
I got a question with regards to the use of loops.
I have panel data and would like to plot the savings rate for each country (using a seperate graph for each country and then combining them in one graph).
Currently, I have the following code.
I presume there is a more efficient way of doing this, using loops but can't figure out how to do this exactly.
Can someone give a hand?
Thanks,
W.
I got a question with regards to the use of loops.
I have panel data and would like to plot the savings rate for each country (using a seperate graph for each country and then combining them in one graph).
Currently, I have the following code.
PHP Code:
line savings_rate year if cid=="AT", xtitle("") ytitle("") title("Austria")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\AT.gph"
line savings_rate year if cid=="BE", xtitle("") ytitle("") title("Belgium")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\BE.gph"
line savings_rate year if cid=="BG", xtitle("") ytitle("") title("Bulgaria")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\BG.gph"
line savings_rate year if cid=="CY", xtitle("") ytitle("") title("Cyprus")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\CY.gph"
line savings_rate year if cid=="CZ", xtitle("") ytitle("") title("Czech Republic")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\CZ.gph"
line savings_rate year if cid=="DE", xtitle("") ytitle("") title("Germany")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\DE.gph"
line savings_rate year if cid=="DK", xtitle("") ytitle("") title("Denmark")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\DK.gph"
line savings_rate year if cid=="ES", xtitle("") ytitle("") title("Spain")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\ES.gph"
line savings_rate year if cid=="FI", xtitle("") ytitle("") title("Finland")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\FI.gph"
line savings_rate year if cid=="FR", xtitle("") ytitle("") title("France")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\FR.gph"
line savings_rate year if cid=="HU", xtitle("") ytitle("") title("Hungary")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\HU.gph"
line savings_rate year if cid=="IE", xtitle("") ytitle("") title("Ireland")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\IE.gph"
line savings_rate year if cid=="IT", xtitle("") ytitle("") title("Italy")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\IT.gph"
line savings_rate year if cid=="NL", xtitle("") ytitle("") title("Netherlands")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\NL.gph"
line savings_rate year if cid=="PT", xtitle("") ytitle("") title("Portugal")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\PT.gph"
line savings_rate year if cid=="SE", xtitle("") ytitle("") title("Sweden")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\SE.gph"
line savings_rate year if cid=="SI", xtitle("") ytitle("") title("Slovenia")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\SI.gph"
line savings_rate year if cid=="SK", xtitle("") ytitle("") title("Slovakia")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\SK.gph"
line savings_rate year if cid=="UK", xtitle("") ytitle("") title("United Kingdom")
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\UK.gph"
gr combine "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\AT.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\BE.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\BG.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\CY.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\CZ.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\DE.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\DK.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\ES.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\FI.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\FR.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\HU.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\IE.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\IT.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\NL.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\PT.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\SE.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\SI.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\SK.gph" "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\UK.gph"
graph save Graph "C:\Users\wvanlaer\Dropbox\Doctoraat\Artikel sparen\Stata\All_countries.gph"
Can someone give a hand?
Thanks,
W.
Comment