sas

SAS Proc Tabulate label for missing row


Suppose a proc tabulate like this

DATA XX;
INPUT var1 $ var2 $;
CARDS;
X Y
X Y
Z Z
X X
Y Z
X .
;
RUN;

PROC TABULATE DATA=XX missing ;
CLASS var1 var2;
TABLES var2, var1 / nocellmerge misstext = "0";
RUN;

enter image description here

I would like to put a label in the square I have circled in red, writing something like "Missing".

Is this possible?


Solution

  • Why not define a format and attach it to the variable VAR2?

    proc format ;
      value $miss ' ' = 'Missing';
    run;
    
    PROC TABULATE DATA=XX missing ;
      CLASS var1 var2;
      TABLES var2, var1 / nocellmerge misstext = "0";
      format var2 $miss8.;
    RUN;