Hello,
I'd like to set a conditional statement based on the first iteration of a FOREACH loop. I am not sure how to identify and store that indexed count, and currently the condition is hard-coded based on the first variable listed in the macro, instead of dynamically based on the first loop.
Thank you!
Preeti
I'd like to set a conditional statement based on the first iteration of a FOREACH loop. I am not sure how to identify and store that indexed count, and currently the condition is hard-coded based on the first variable listed in the macro, instead of dynamically based on the first loop.
Guidance would be appreciated.
local logvars = "f_hdl f_a1c f_race"
foreach var in `logvars' {
.....
graph export "${prog}gph_`var'.tif", replace
graph save `var'.gph,replace
gr export temp.png, height(450) width(600) replace
if `var' == f_hdl {//I'd like to replace this with a index count = 1
png2rtf using 05_diagnostic_plots.doc, g(temp.png) replace
}
else {
png2rtf using 05_diagnostic_plots.doc, g(temp.png) append
....
}
Thank you!
Preeti
Comment