Today's post is just a quick little SAS MACRO tip. Suppose you are working in a macro and you need to compare a macro variable to an empty string. You can simply say:
%if &myVar = %then ...;
But that is not the most intuitive, especially when you have more complex logic such as:
%if &myVar = and &nextVar = something %then ...;
Looks a little confusing. Like I forgot to type something after the equals sign!
I like to handle this by using %STR( ). That way you can see that I am definetly testing for a blank. Such as:
%if &myVar = %str( ) %then ...;