Not all your code is posting because of the less than signs in the text.
From the Macro Expressions documentation ( I had to substitute LT for the symbol, and add spaces arount LT).
Note: Expressions in which comparison operators surround a macro expression, as in 10 LT &X LT 20, might or might not be the equivalent of a DATA step compound expression (depending on what the expression resolves to). To be safe, write the connecting operator explicitly, as in the expression 10 LT &X AND &X LT 20.
I would go a bit further and put the spaces around the symbolic tokens, and make one other change, use 00 instead of 0 to insure 9 is greater than 0 and not 9 is greater than a space or null or something:
[pre]
%if 00 LE &fyr AND &fyr LT &yr %then ...
[/pre]
Also, the code for last year should not work properly.
&yr is always equal to &yr, but your condition is less than, so it should always fail and never process the %then statement(s). Then, 07 is less than 20 so that should have failed as well. So where did last_year get its value of 2007 from?
Message was edited by: Chuck