Hello.
I am trying to generate graphs from some variables. I do not have all possible combinations of v iv p s. I want Stata to generate graphs with all combinations I have but without stopping and returning error.
This is the code I am using:
foreach v in bi y fi w ti {
foreach s in qe nqe {
foreach pi in t3m t6m t1y t2y t3y t5y t7y t10y {
foreach iv in ed1 ed2 ed3 ed4 ff1 ff2 ff3 ff4 mp1 mp2 mp3 mp4 pc1 {
qui: twoway (rarea min_`v'_`pi'_`iv'_`s'_68 max_`v'_`pi'_`iv'_`s'_68 horizon , pstyle(ci)) ///
(line max_`v'_`pi'_`iv'_`s'_90 horizon, lcolor(black) lpattern(dash) lstyle(ci) ) ///
(line min_`v'_`pi'_`iv'_`s'_90 horizon, lcolor(black) lpattern(dash) lstyle(ci) ) ///
(line b_`v'_`pi'_`iv'_`s'_90 horizon, lcolor(red) lpattern(solid)), ///
title("`v'", color(black) size(medium)) ///
ytitle("Percent", size(medsmall)) xtitle("Horizon", size(medsmall)) ///
graphregion(color(white)) plotregion(color(white)) ///
legend(off) ///
title("GK shocks: `v'_`pi'_`iv'_`s'")
graph save "C:\****\irf_`pi'_`iv'_`v'_`s'.gph", replace
}
}
}
}
Thank you for your help.
Related Posts with How to make a loop continue working if a variable it is not found?
Copy variable values into a data structure?Hello Xperts, Just wondering if there is any way in STATA to capture all the values (ignoring missi…
sorting and creation of variablesHi everyone, I have two questions for you. I have a panel in which I have date, ID, company and out…
JACCARD similarity measureHi I am working on similarity measure on the different assets classification. I have close to 12 ass…
Panel data which is non-missing for some variables and missing on Saturdays/Sundays/holidays for other variablesGood day, I have a general question regarding best practices for panel data which is non-missing fo…
Simulating different scenarios in a FE panel model with lagged explanatory variableHello! I have a rather general question about my statistical approach - if helpful, I can also post …
Subscribe to:
Post Comments (Atom)
0 Response to How to make a loop continue working if a variable it is not found?
Post a Comment