Help using Base SAS procedures

Remove "Table of Variable1 by Variable2" Title in 2-by-2 Cross-Tabulation in PROC FREQ

Accepted Solution Solved
Reply
Contributor
Posts: 40
Accepted Solution

Remove "Table of Variable1 by Variable2" Title in 2-by-2 Cross-Tabulation in PROC FREQ

Dear Community,

If you run the following code,

proc freq

  data = sashelp.class;

  tables age * sex;

run;

you will find that the output table contains the title "Table of Age by Sex".  How can I remove this title?

I have tried playing around with the "title" statement and searching on Google and this forum, but to no avail.

Thanks,

Eric


Accepted Solutions
Solution
‎10-01-2014 02:36 PM
Contributor
Posts: 40

Re: Remove "Table of Variable1 by Variable2" Title in 2-by-2 Cross-Tabulation in PROC FREQ

Hi Art,

Thanks for the link.  I solved my problem by modifying the template's code as given in the appendix.  I also wanted my table to display only the variables' labels, not their names.  Here are the steps that I took:

  • Delete the chunk of code starting from "delete TableOf" to its own end.  Also, delete "TableOf" in the header statement within the first definition for crosstabs.  This will rid the annoying "Table of Var1 by Var2" title.

  • Delete the relevant parts (_ROW_NAME_ or _ROW_LABEL_) in the definition of the RowsHeader and the ColsHeader to control the display of the variable name or label in the row/column.

  • Run this template before every analysis SAS script.  I have a separate file for my library names and other SAS formatting options (like PROC FORMAT or clearing my log, output window, and results viewer), and I have added the code for this template (with my modifications) into that file.  I then use the %include statement to run this file in my actual analysis SAS script.

Thanks again for your help, Art!

View solution in original post


All Replies
PROC Star
Posts: 7,474

Re: Remove "Table of Variable1 by Variable2" Title in 2-by-2 Cross-Tabulation in PROC FREQ

Solution
‎10-01-2014 02:36 PM
Contributor
Posts: 40

Re: Remove "Table of Variable1 by Variable2" Title in 2-by-2 Cross-Tabulation in PROC FREQ

Hi Art,

Thanks for the link.  I solved my problem by modifying the template's code as given in the appendix.  I also wanted my table to display only the variables' labels, not their names.  Here are the steps that I took:

  • Delete the chunk of code starting from "delete TableOf" to its own end.  Also, delete "TableOf" in the header statement within the first definition for crosstabs.  This will rid the annoying "Table of Var1 by Var2" title.

  • Delete the relevant parts (_ROW_NAME_ or _ROW_LABEL_) in the definition of the RowsHeader and the ColsHeader to control the display of the variable name or label in the row/column.

  • Run this template before every analysis SAS script.  I have a separate file for my library names and other SAS formatting options (like PROC FORMAT or clearing my log, output window, and results viewer), and I have added the code for this template (with my modifications) into that file.  I then use the %include statement to run this file in my actual analysis SAS script.

Thanks again for your help, Art!

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 741 views
  • 3 likes
  • 2 in conversation