Column headers containing a percent sign (%) might generate double percent signs (%%)


Specifying a single percent sign (%) as a character in a column header might result in double percent signs (%%). This can occur in any destination, including the traditional Listing output. It can occur when you use certain procedures, including PROC FREQ, PROC MEANS, or with FILE PRINT ODS.

The sample code below illustrates the problem.

ods listing;
ods pdf file='test.pdf';

data class;
   set sashelp.class;
   label age='Age %';
run;
proc freq data=class;
   tables age*sex;
run;
proc means data=class;
   var age;
run;

ods pdf close;

One workaround is to use the Unicode symbol for a percent sign (%) which will affect the non-listing ODS destinations. For example:

ods escapechar='^';
data class;
   set sashelp.class;
   label age='Age ^{unicode 0025}';
run;

Another workaround is to use PROC TABULATE, which will affect all ODS destinations:

proc tabulate data=class;
   class sex age;
   table age, sex;
run;