Dear Leo,
You cannot do that with the macro language because these conditions are evaluated before the model is actually analyzed by Dynare’s preprocessor and run by Matlab/Octave. The condition you have in mind should ve evaluated at run time. To do that see this post.
Best,
Stéphane.