Sample 48277: Modify the CrossTabFreqs template to display variable labels without variable names in PROC FREQ results
You can display variable labels without the variable names in a two-way PROC FREQ table by making a temporary modification to the Base.Freq.CrossTabFreqs template prior to your PROC FREQ step. The sample program on the
Full Code tab can be used for this purpose.
The Base.Freq.CrossTabFreqs template was not available prior to SAS® 9.2.
An alternative method for displaying labels only in PROC FREQ two-way tables that does not require a template modification can be found in SAS Note 48278.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
The code below shows how you can modify the default CrossTabFreqs template to display variable labels without variable names in PROC FREQ two-way tables.
/* Include the ODS PATH to write to a temporary template store */
ods path (prepend) work.templat(update);
ods path show;
proc template;
edit Base.Freq.CrossTabFreqs;
cellvalue Frequency Expected Deviation CellChiSquare TotalPercent
Percent RowPercent ColPercent CumColPercent;
header TableOf ControllingFor;
define TableOf;
text "Table of " _ROW_LABEL_ " by " _COL_LABEL_ ;
end;
define header rowsheader;
text _row_label_ / _row_label_ ^=' ';
text _row_name_;
end;
define header colsheader;
text _col_label_ / _col_label_ ^=' ';
text _col_name_;
cindent = ";";
space = 1;
end;
cols_header=colsheader;
rows_header=rowsheader;
header tableof;
end;
run;
title;
ods noproctitle;
ods html file='temp.html';
proc freq data=sashelp.class;
tables age*sex / norow nocol;
label sex='Student Gender'
age='Age in Years';
title 'PROC FREQ displaying variable labels';
run;
ods html close;
/* Delete the temporary modification */
proc template;
delete Base.Freq.CrossTabFreqs;
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample illustrates how to modify the default template to display variable labels without variable names in PROC FREQ two-way tables.
Date Modified: | 2012-11-07 09:33:32 |
Date Created: | 2012-10-26 09:13:12 |
Operating System and Release Information
SAS System | Base SAS | z/OS | 9.21 | | 9.2 TS2M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.21 | | 9.2 TS2M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.21 | | 9.2 TS2M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.21 | | 9.2 TS2M0 | |
Microsoft Windows XP 64-bit Edition | 9.21 | | 9.2 TS2M0 | |
Microsoft® Windows® for x64 | 9.21 | | 9.2 TS2M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.21 | | 9.2 TS2M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.21 | | 9.2 TS2M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.21 | | 9.2 TS2M0 | |
Microsoft Windows Server 2003 for x64 | 9.21 | | 9.2 TS2M0 | |
Microsoft Windows Server 2008 for x64 | 9.21 | | 9.2 TS2M0 | |
Microsoft Windows XP Professional | 9.21 | | 9.2 TS2M0 | |
Windows Vista | 9.21 | | 9.2 TS2M0 | |
Windows Vista for x64 | 9.21 | | 9.2 TS2M0 | |
64-bit Enabled AIX | 9.21 | | 9.2 TS2M0 | |
64-bit Enabled HP-UX | 9.21 | | 9.2 TS2M0 | |
64-bit Enabled Solaris | 9.21 | | 9.2 TS2M0 | |
HP-UX IPF | 9.21 | | 9.2 TS2M0 | |
Linux | 9.21 | | 9.2 TS2M0 | |
Linux for x64 | 9.21 | | 9.2 TS2M0 | |
OpenVMS on HP Integrity | 9.21 | | 9.2 TS2M0 | |
Solaris for x64 | 9.21 | | 9.2 TS2M0 | |