0
votes

I am trying to use the %Dropmiss Macro in sas, which I found from an official PDF https://support.sas.com/resources/papers/proceedings10/048-2010.pdf

however, when I try to use it, I always get the same error:

ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: "%qtrim(&&CHARMAX&I)" eq ""

Being a newbie in Macros, I have tried to find a solution everywhere , but nothing so far. What is possibly the problem? What should I do or check in my data to fix the problem.

Thank you,

1
Run the program with the MPRINT and SYMBOLGEN options and then post the whole section that generates the error please.Reeza
options mprint symbolgen; is what you put before the macro.Reeza

1 Answers

0
votes

Not sure about your macro but you don't need a macro. That paper is a decade old so here's a more modern approach.

ods select none;
ods output nlevels=temp;
proc freq data=have nlevels;
 tables _all_;
run;

proc sql;
 select tablevar into : drop separated by ','
  from temp
   where NNonMissLevels=0;

  alter table data&i
   drop &drop; 
quit;

Original source, since not my code: https://communities.sas.com/t5/SAS-Programming/deleting-empty-columns/m-p/308045