Code:
local shockvars "rt_inc rt_dec level_inc level_dec" local gaslist "co2 so4 n2o ch4 bod" local co2_lab "Carbon Dioxide" local so4_lab "Sulfur Dioxide" ...... ...... ..... ..... local shockvars "rt_inc rt_dec level_inc level_dec" local rt_inc_lab "..." ... ... ... foreach lhsvars of local gaslist{
foreach shockvar of local shockvars {
[INDENT=2]if inlist("`lhsvar'", "co2", "so2") == 1 {[/INDENT][INDENT=3]twoway (var1 `lhsvar' date) /// title(``lhsvar'_lab, `shockvar'_lab', color(black) size(medium))[/INDENT][INDENT=2]} else {[/INDENT][INDENT=3]twoway (var1 `lhsvar' date) /// title(``lhsvar'_lab', color(black) size(medium))[/INDENT][INDENT=2]}[/INDENT]
}
}
0 Response to How to use if statement in foreach loop?
Post a Comment