Hi, I would like to impose a condition in the foreach function on a variable which is not one of the varlist. Is this possible?

foreach var of varlist M_BART_Adj Tu_BART_Adj W_BART_Adj Th_BART_Adj F_BART_Adj Sa_BART_Adj Su_BART_Adj {
if sense>=3{
egen mean_high`var'=mean(`var')
egen se_high`var'=semean(`var')
}
}

The condition is if sense>=3, but Stata does not seem to take this into account.