I'm attempting to plot gas concentrations over time, but want to format the graphs differently for some of the gasses. My actually dataset is much larger, and I took a subset for the purposes of this question. I also have other variables in my dataset that are used in the plotting as well. My goal is to have the CO2 and SO2 plots have a different plot title then the rest. The current problem is that my plots for all variables are being exported as if they came from else loop later in my code, which I do not want. Here is what my current code looks like:

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]
}
  }
Any suggestions on how to fix this? I can't break the loops up because there are too many variables.