The formatted output of the MEANS procedure can differ from expectations because the ODS template for the procedure contains an option that causes default attributes, such as format width, to be used instead of those attributes explicitly specified in numeric formats associated with or applied to variables. For example, numeric format output can be wider (have more characters) than expected when the default format width is greater than the specified width. Similarly, the output can be narrower when the default width is less than the specified width. This issue affects only ODS output (printed output to any destination or an ODS output data set) from PROC MEANS and does not affect internal numeric representation or calculation of results. Output data sets created through ODS will have formats with default attributes applied to the variables. Output data sets created by the traditional OUTPUT statement are not similarly affected.
The following example illustrates this behavior.
data foo; input c x; datalines; 123 1 1233 2 1234 3 12345 4 12346 5 123456 6 1234567 7 1234568 8 12345678 9 12345679 10 ; run; ods output summary=odsout; proc means data=foo sum nway; class c; var x; format c dollar10.; output out=meansout sum=Sum; run; proc print data=odsout; run; proc print data=meansout; run; proc contents data=odsout; run; proc contents data=meansout; run;
Here, because of the USE_FORMAT_DEFAULTS option in the procedure's ODS template, the width of 10 specified for the DOLLAR format in the FORMAT statement is overridden by the format's default width of 6. In the printed output of PROC MEANS, this causes the values of variable C to be limited to 6 characters, and in the ODS output data set, variable C has a format of DOLLAR6.
If you do not desire default formats to be applied to the output data set, then create your output data set using the OUTPUT statement instead of ODS OUTPUT. If you do not desire ODS output from PROC MEANS to use default format attributes, then you can modify the Base.Summary ODS table template as shown below.
proc template; edit base.summary; use_format_defaults=off; end; run;
Click the Output tab to see a comparison of the ODS output, the OUTPUT statement output, and the modified ODS output with the template changes.
Product Family | Product | System | SAS Release | |
Reported | Fixed* | |||
SAS System | Base SAS | Solaris for x64 | 9.3 TS1M0 | |
Linux for x64 | 9.3 TS1M0 | |||
Linux | 9.3 TS1M0 | |||
HP-UX IPF | 9.3 TS1M0 | |||
64-bit Enabled Solaris | 9.3 TS1M0 | |||
64-bit Enabled HP-UX | 9.3 TS1M0 | |||
64-bit Enabled AIX | 9.3 TS1M0 | |||
Windows Vista for x64 | 9.3 TS1M0 | |||
Windows Vista | 9.3 TS1M0 | |||
Windows 7 Ultimate x64 | 9.3 TS1M0 | |||
Windows 7 Ultimate 32 bit | 9.3 TS1M0 | |||
Windows 7 Professional x64 | 9.3 TS1M0 | |||
Windows 7 Professional 32 bit | 9.3 TS1M0 | |||
Windows 7 Home Premium x64 | 9.3 TS1M0 | |||
Windows 7 Home Premium 32 bit | 9.3 TS1M0 | |||
Windows 7 Enterprise x64 | 9.3 TS1M0 | |||
Windows 7 Enterprise 32 bit | 9.3 TS1M0 | |||
Microsoft Windows XP Professional | 9.3 TS1M0 | |||
Microsoft Windows Server 2008 for x64 | 9.3 TS1M0 | |||
Microsoft Windows Server 2008 R2 | 9.3 TS1M0 | |||
Microsoft Windows Server 2008 | 9.3 TS1M0 | |||
Microsoft Windows Server 2003 for x64 | 9.3 TS1M0 | |||
Microsoft Windows Server 2003 Standard Edition | 9.3 TS1M0 | |||
Microsoft Windows Server 2003 Enterprise Edition | 9.3 TS1M0 | |||
Microsoft Windows Server 2003 Datacenter Edition | 9.3 TS1M0 | |||
Microsoft® Windows® for x64 | 9.3 TS1M0 | |||
Z64 | 9.3 TS1M0 | |||
z/OS | 9.3 TS1M0 |
Default ODS output c NObs x_Sum $123 1 1 $1,233 1 2 $1,234 1 3 $12345 1 4 $12346 1 5 123456 1 6 1.23E6 1 7 1.23E6 1 8 1.23E7 1 9 1.23E7 1 10 Default OUTPUT statement output c _TYPE_ _FREQ_ Sum $123 1 1 1 $1,233 1 1 2 $1,234 1 1 3 $12,345 1 1 4 $12,346 1 1 5 $123,456 1 1 6 $1,234,567 1 1 7 $1,234,568 1 1 8 $12345678 1 1 9 $12345679 1 1 10 Modified ODS output with Template changes c NObs x_Sum $123 1 1 $1,233 1 2 $1,234 1 3 $12,345 1 4 $12,346 1 5 $123,456 1 6 $1,234,567 1 7 $1,234,568 1 8 $12345678 1 9 $12345679 1 10
Type: | Usage Note |
Priority: | medium |
Date Modified: | 2014-02-13 16:32:35 |
Date Created: | 2013-10-18 11:30:23 |