I have a do file which contains a macro list. I want to evaluate each element of the list and determine if it meets a particular criterion:

Code:
local roots_orig amlo aten azil ben carv chlor
foreach var of local roots_orig {
  if `var'_min == 0
Then, I want to go over the list again, but this time removing the elements from the list for which the criterion is true. For example, if amlo_min were equal to zero, the revised list should be:

Code:
local roots_orig aten azil ben carv chlor
Obviously, I could simply skip elements in the list when `var'_min == 0, but the situation is more complicated than that and I really need to recover the reduced list.

I dimly recall someone responding to a similar question a few years ago and showing how to do it, but I can not find the original post.