jeudi 13 juillet 2017

A character operand was found in the %EVAL function or %IF condition where a numeric operand is required

I have a macro with the following input variables: cat_var, model, validate.

When I enter the following call the macro runs fine:

%models(cat_var=mommy dadmy,model=age readhr mommy dadmy,validate=no);

But then when I enter this call:

%models(cat_var=mommy dadmy,model=age readhr mommy dadmy age*readhr,validate=no);

I get this error message:

A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &validate = or (&cat_var = and &model =) or (&cat_var ^= and &model =)

Therefore, I believe I have isolated the issue to the following code I have written:

%if &validate = or (&cat_var = and &model =) or (&cat_var ^= and &model =) %then 
%put ERROR: One or more inputs are missing. Check to make sure all macro variables have an input where necessary. (It is not necessary to have cat_var inputs);

The logic I intended for this code to use is as follows:

If validate is missing an input OR (cat_var AND model are missing an input) OR (cat_var is NOT missing an input AND model is missing an input) then display an error message.

This code worked as I expected until I entered a * symbol in the model input. Is this what's screwing it up? And how can I fix this?

Aucun commentaire:

Enregistrer un commentaire