The reason concerns how an %IF condition interprets a dash. Remember, %EVAL is applied to all %IF conditions. Thus if a dash is present, it triggers the attempt to subtract.
Consider a simple case:
%let club = 4-H;
%if &club = 4-H %then %do;
Assuming these statements are contained within a macro definition (so %IF is legal), the first statement always works. And the second statement always generates an error. The dash triggers %EVAL to perform subtraction. However, this comparison would work:
%if "&club" = "4-H" %then %do;
By adding the double quotes, %EVAL now figures out it should perform a character comparison and not attempt to subtract.
This post was in response to your post #3. Regarding your post #4, try inserting some diagnostics. After assigning a value to &error, display the value with a %PUT statement. Better yet, turn on debugging options such as MLOGIC and SYMBOLGEN.
... View more