Sample 38001: How to add a percent sign to PROC TABULATE table cell percents
You might want to display a percent sign (%) after the percents in your table created by PROC TABULATE. If you were to try to use the PERCENTw.d format, remember that it multiplies data values by 100, formats them the same as the BESTw.d format, and adds a percent sign (%) to the end of the formatted value, while it encloses negative values in parentheses. The PERCENTw.d format allows room for a percent sign and parentheses, even if the value is not negative.
PROC TABULATE has already multipled the mean values by 100 to compute the percent. Therefore, if you use the PERCENTw.d format to format the percent values, the values will be incorrect.
Since you do not want the value multiplied by 100, you will need to create a picture format using PROC FORMAT to add the percent sign to the value. Please see the sample program on the Full Code tab for an example.
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.
PROC FORMAT creates a picture format to add a percent sign to percent values in PROC TABULATE.
proc format;
picture mypct (round) low-high='009.99%';
run;
proc tabulate data=sashelp.class;
class age sex;
var weight height;
table age, sex*(weight height)*(pctsum*f=mypct.);
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.
You can add percent signs to your PROC TABULATE table cell percents by creating a picture format with PROC FORMAT.
Date Modified: | 2010-02-03 13:25:27 |
Date Created: | 2009-12-02 12:18:28 |
Operating System and Release Information
SAS System | Base SAS | z/OS | 9.21 | | | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.21 | | | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.21 | | | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.21 | | | |
Microsoft Windows XP 64-bit Edition | 9.21 | | | |
Microsoft® Windows® for x64 | 9.21 | | | |
Microsoft Windows 7 | 9.21 | | | |
Microsoft Windows 95/98 | 9.21 | | | |
Microsoft Windows 2000 Advanced Server | 9.21 | | | |
Microsoft Windows 2000 Datacenter Server | 9.21 | | | |
Microsoft Windows 2000 Server | 9.21 | | | |
Microsoft Windows 2000 Professional | 9.21 | | | |
Microsoft Windows NT Workstation | 9.21 | | | |
Microsoft Windows Server 2003 Datacenter Edition | 9.21 | | | |
Microsoft Windows Server 2003 Enterprise Edition | 9.21 | | | |
Microsoft Windows Server 2003 Standard Edition | 9.21 | | | |
Microsoft Windows Server 2008 | 9.21 | | | |
Microsoft Windows XP Professional | 9.21 | | | |
Windows Millennium Edition (Me) | 9.21 | | | |
Windows Vista | 9.21 | | | |
64-bit Enabled AIX | 9.21 | | | |
64-bit Enabled HP-UX | 9.21 | | | |
64-bit Enabled Solaris | 9.21 | | | |
HP-UX IPF | 9.21 | | | |
Linux | 9.21 | | | |
Linux for x64 | 9.21 | | | |
OpenVMS on HP Integrity | 9.21 | | | |
Solaris for x64 | 9.21 | | | |