By George, I've got it - and it was, as it so often is, macro quoting, as hinted at by @Reeza.
If you replace the macro comparison with
%if %nrquote(&id) = %nrquote(EQ) %then %do;
which effectively does the same thing as @Reeza's suggestion, it all falls into place. Without the quoting, it's interpreted logically along the lines of
%if EQ EQ EQ %then %do;
which will parse at execution time, after a fashion, but it's meaningless.
Because eq is a reserved operand in macro code, it has to be quoted so that it isn't interpreted as an operand.
... View more