I don't understand what you are trying to do.
Your macro logic does not have any conditional logic to prevent if from generating one variable in the select list for each iteration of the %DO loop.
What are the names of your dataset variables? Does you dataset even have variables named UP, DOWN or BASE? Are they character variables? Do any of them ever have values like 'Up' or 'Down'?
... View more