/************************************************************ * check if a macro variable is blank. * * Peng Zeng (Auburn University) * 10-16-2018 ************************************************************/ /************************************************************ * macro function to test if a macro variable is blank * returns * 1 if the tested macro variable is blank * 0 otherwise * * blank means that the macro variable resolves to a blank * if the macro variable is not defined, return 0 ************************************************************/ %macro isBlank(param); %sysevalf(%superq(param)=, boolean) %mend isBlank; %let amacro = 123; %let nullmacro = ; %let blankmacro = ""; data one; a = %isBlank(&amacro); /* value = 0 */ b = %isBlank(&nullmacro); /* value = 1 */ c = %isBlank(&blankmacro); /* value = 0 */ d = %isBlank(¬macro); /* value = 0, macro not defined */ run; proc print data = one; run;