It is obvious how if COULD have worked in the past if you consider the complete rules for scoping of macro variables.
If you assign a value to a macro variable SAS will first use the macro variable of that name that it currently can see. If no such macro variable exists it will make a new one in the current macro symbol table. Normally inside a macro that symbol table will be LOCAL to the macro currently running and so the macro variable created there will not exist after the macro ends execution.
So all you need to do to get your program to work is define the macro variable BEFORE calling the macro that you want to assign it a value.
So add this line to the top of the program:
%let tot_c=not known yet ;
Or add this line to the top of the macro that assigning it a value:
%if not %symexist(tot_c) %then %global tot_c;
... View more