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?
sequential counting helpHi, I have a dataset with two different procedures (proc1 & proc 2). Some id's have multiple pr…
mixed effects model with random slopes for categorical variablesDear all I am trying to estimated the effect of positive and negative changes in income on GHQ (wel…
Time Dummy Variable for xtabond2Hi A little background first. I am trying to test how democracy levels impact GDP. I am using the d…
categorical variableDear Members Hello i am working on Pakistan consumption data and using categorical variables. howev…
Is there a way to export a codebook to excel with notes included?I am using the codebookout module to export a data set's codebook to excel. That said, it doesn't ex…
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