Help using Base SAS procedures

Hide legend box in proc FREQ?

Not applicable
Posts: 1

Hide legend box in proc FREQ?

I am running a basic cross tabulation of two variables (Field, Exam_Date) in a proc freq statement using the following code: proc freq data=regdata2 notitle; table Field*Exam_Date/ norow nocol nopercent; run; The table itself is coming out fine but I still get the legend box on the left of the output screen, which only says the word "frequency" since I told the proc to hide row/column percents, etc.. Is there a way to hide that little legend box and just display the table itself?  The legend box is not needed.  Thanks!

Posts: 9,373

Re: Hide legend box in proc FREQ?


  I'd switch to PROC REPORT or PROC TABULATE if all you want is frequency counts in a crosstabular layout. Either procedure would give you what you want without that little box, which is a feature of PROC FREQ and sort of hard to get rid of, not impossible, but not easy, either.

  I not on a machine where I can post code, but if you search for previous forum postings, there have been many good examples of both TABULATE and REPORT.


Super User
Posts: 13,583

Re: Hide legend box in proc FREQ?

Equivalent proc tabulate code would be:

proc tabulate data=regdata2;

     class field exam_data;

     table field,exam_data*n=' '*f=f6.0;


if your counts are more than 999999 make the f6.0 larger.

This code will not display counts where either of Field or Exam_data are missing. If you want to see the missing, if any, add "/ missing" to the class statement after the variable names.

Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation