I am not sure what is not working with the following code. I am trying to write a macro variable (yesterday) that jumps back to Friday (3 days) when it is Monday, otherwise the Macro variable should jump back one day. Take a look --
The other issue I see with your code (beyond what Scott has noted with scope issues and the fact that you don't need a DATA _NULL_ step at all), is that &TODAY will hold today's date, but &DAY will hold the result of using the WEEKDAY format.
You can test the values of these 2 macro variables by doing this:
%put today= &today;
%put day= &day;
It seems to me that if you test &TODAY, you will be testing a date value and NOT the day of the week. So, scope issues aside, you might want to consider testing &DAY and not &TODAY. You can take care of some of the scope issues by using an explicit %GLOBAL statement.
Since the %IF must be used in a Macro program, you will still need the macro program definition for %YESTER. However you do NOT need the DATA _NULL_ and you must still resolve the scope issues if you plan/hope to use &YESTERDAY outside the scope of the local macro program environment.