Not entirely sure what you are doing, but the error message is probably because you are mixing macro
code with data step
code. Trying change to this:
if last then do;
hlo='O';
label='*ERROR';
output;
end;
In other words, get rid of the ampersands (which indicate macro variable references).
And also be sure to add a run;
statement at the end of each data step and after the PROC FORMAT
call.