SUPPORT / SAMPLES & SAS NOTES
 

Support

Usage Note 37106: Increase (or decrease) the number of decimal places in procedure results

DetailsAboutRate It

To increase or decrease the displayed precision in SAS® procedure results, the easiest approach is to write the results to a data set using an ODS OUTPUT statement, then use the FORMAT statement with PROC PRINT to display the results with the desired number of decimal places. There is no global option that can change the precision in all displayed results.

Note that this approach can be used with any table from any SAS procedure. The following examples use the method to change the displayed precision for just two particular tables from two procedures.

Example 1: Parameter estimates table from PROC REG

In the following example, the Parameter Estimates table reports p-values of 0.0004 and <.0001 and it is desired to display these p-values with more precision. For the parameter estimates, only 2 decimal places are desired. Begin by writing the Parameter Estimates table to a data set using an ODS OUTPUT statement. The table name is needed in this statement to specify which table is to be written to a data set. The Parameter Estimates table in PROC REG (and many other modeling procedures) is named ParameterEstimates. See this usage note on how to determine table names.

   data Class; 
      input Name $ Height Weight Age @@; 
      datalines; 
   Alfred  69.0 112.5 14  Alice  56.5  84.0 13  Barbara 65.3  98.0 13 
   Carol   62.8 102.5 14  Henry  63.5 102.5 14  James   57.3  83.0 12 
   Jane    59.8  84.5 12  Janet  62.5 112.5 15  Jeffrey 62.5  84.0 13 
   John    59.0  99.5 12  Joyce  51.3  50.5 11  Judy    64.3  90.0 14 
   Louise  56.3  77.0 12  Mary   66.5 112.0 15  Philip  72.0 150.0 16 
   Robert  64.8 128.0 12  Ronald 67.0 133.0 15  Thomas  57.5  85.0 11 
   William 66.5 112.0 15 
   ;
   
   ods output parameterestimates=pe;
   proc reg data=Class;
      model Weight = Height;
      run; quit;
Parameter Estimates
Variable DF Parameter
Estimate
Standard
Error
t Value Pr > |t|
Intercept 1 -143.02692 32.27459 -4.43 0.0004
Height 1 3.89903 0.51609 7.55 <.0001

The PVALUEw.d format is the format used by procedures to display p-values, where w is the width of the value and d is the number of decimal places to show. It displays the "<" symbol for values too small to be represented in the width provided as can be seen in the PROC REG results above. Assigning the format PVALUE12.10 to the variable containing the p-value, PROBT, presents its values with 10 decimal places as opposed to the 4 decimal places displayed by PROC REG. The w.d format, 12.10, could also be used.

Similarly, the w.d format, 8.2, assigned to the ESTIMATE variable displays the parameter estimates with two decimal places.

The results of the following PROC PRINT step redisplay the Parameter Estimates table from PROC REG with the desired precision. The LABEL option displays the variable labels instead of the variable names.

   proc print data=pe label; 
      id variable;
      format estimate 8.2 
             probt    pvalue12.10; 
      var _numeric_;
      title "Parameter Estimates";
      run;
Parameter Estimates

Variable DF Parameter Estimate Standard Error t Value Pr > |t|
Intercept 1 -143.03 32.27459 -4.43 0.0003655789
Height 1 3.90 0.51609 7.55 0.0000007887

Example 2: Odds ratio estimates table from PROC LOGISTIC

When a predictor in a logistic model has a strong association with the response, the odds ratio estimate for the predictor can be quite large or small. In such cases, the odds ratio estimate and/or the confidence limits for the odds ratio displayed in the Odds Ratio Estimates table may appear as "<.001" or ">999.999". The table can be displayed with more precision using the above method.

Again, it is necessary to determine the name of the table so that it can be saved using an ODS OUTPUT statement. See "ODS Table Names" in the Details section of the procedure's documentation to find a list of table names. As shown in the LOGISTIC documentation, the name of the Odds Ratio Estimates table that is displayed by default is OddsRatios.

In the following example, the predictor, R, has a very strong effect on the response. As a result, its odds ratio estimate and both limits are very small and are displayed as "<.001." The Odds Ratio Estimates table is saved for redisplay by the ODS OUTPUT statement.

      data a; 
        do r=1,2; 
        do c=1,2; 
          input f @@; 
          output; 
        end; end;
        datalines;
      200 1
      1 200
      ;
      proc logistic; 
        freq f; 
        model c=r; 
        ods output oddsratios=or;
        run;
Odds Ratio Estimates
Effect Point Estimate 95% Wald
Confidence Limits
r <0.001 <0.001 <0.001

This step displays the Odds Ratio Estimates table using more precision for the estimate and limits.

      proc print data=or label; 
        id effect;
        format _numeric_ 10.8;
        var _numeric_;
        title "Odds Ratio Estimates";
        run;
Odds Ratio Estimates

Effect Odds Ratio Estimate Lower 95% Confidence
Limit for Odds
Ratio
Upper 95% Confidence
Limit for Odds
Ratio
r 0.00002500 0.00000155 0.00040247

Example 3: Change ALL p-values in ALL procedures

Submitting the following statements will change the p-value format used for all displayed p-values in all procedures to the PVALUE9.7 format. This will stay in effect across SAS sessions until revoked.

      proc template;
         define column Common.PValue;
            notes "Default p-value column";
            just = r;
            format = pvalue9.7;
         end;
         run;

You can return to the default p-value format used by all procedures in the current and subsequent SAS sessions by submitting these statements.

      proc template;
         delete Common.PValue;
         run;


Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemSAS/STATz/OS
OpenVMS VAX
Microsoft® Windows® for 64-Bit Itanium-based Systems
Microsoft Windows Server 2003 Datacenter 64-bit Edition
Microsoft Windows Server 2003 Enterprise 64-bit Edition
Microsoft Windows XP 64-bit Edition
Microsoft® Windows® for x64
OS/2
Microsoft Windows 95/98
Microsoft Windows 2000 Advanced Server
Microsoft Windows 2000 Datacenter Server
Microsoft Windows 2000 Server
Microsoft Windows 2000 Professional
Microsoft Windows NT Workstation
Microsoft Windows Server 2003 Datacenter Edition
Microsoft Windows Server 2003 Enterprise Edition
Microsoft Windows Server 2003 Standard Edition
Microsoft Windows Server 2008
Microsoft Windows XP Professional
Windows Millennium Edition (Me)
Windows Vista
64-bit Enabled AIX
64-bit Enabled HP-UX
64-bit Enabled Solaris
ABI+ for Intel Architecture
AIX
HP-UX
HP-UX IPF
IRIX
Linux
Linux for x64
Linux on Itanium
OpenVMS Alpha
OpenVMS on HP Integrity
Solaris
Solaris for x64
Tru64 UNIX
SAS SystemSAS/ETSz/OS
OpenVMS VAX
Microsoft® Windows® for 64-Bit Itanium-based Systems
Microsoft Windows Server 2003 Datacenter 64-bit Edition
Microsoft Windows Server 2003 Enterprise 64-bit Edition
Microsoft Windows XP 64-bit Edition
Microsoft® Windows® for x64
OS/2
Microsoft Windows 8 Enterprise 32-bit
Microsoft Windows 8 Enterprise x64
Microsoft Windows 8 Pro 32-bit
Microsoft Windows 8 Pro x64
Microsoft Windows 8.1 Enterprise 32-bit
Microsoft Windows 8.1 Enterprise x64
Microsoft Windows 8.1 Pro
Microsoft Windows 8.1 Pro 32-bit
Microsoft Windows 95/98
Microsoft Windows 2000 Advanced Server
Microsoft Windows 2000 Datacenter Server
Microsoft Windows 2000 Server
Microsoft Windows 2000 Professional
Microsoft Windows NT Workstation
Microsoft Windows Server 2003 Datacenter Edition
Microsoft Windows Server 2003 Enterprise Edition
Microsoft Windows Server 2003 Standard Edition
Microsoft Windows Server 2003 for x64
Microsoft Windows Server 2008
Microsoft Windows Server 2008 R2
Microsoft Windows Server 2008 for x64
Microsoft Windows Server 2012 Datacenter
Microsoft Windows Server 2012 R2 Datacenter
Microsoft Windows Server 2012 R2 Std
Microsoft Windows Server 2012 Std
Microsoft Windows XP Professional
Windows 7 Enterprise 32 bit
Windows 7 Enterprise x64
Windows 7 Home Premium 32 bit
Windows 7 Home Premium x64
Windows 7 Professional 32 bit
Windows 7 Professional x64
Windows 7 Ultimate 32 bit
Windows 7 Ultimate x64
Windows Millennium Edition (Me)
Windows Vista
Windows Vista for x64
64-bit Enabled AIX
64-bit Enabled HP-UX
64-bit Enabled Solaris
ABI+ for Intel Architecture
AIX
HP-UX
HP-UX IPF
IRIX
Linux
Linux for x64
Linux on Itanium
OpenVMS Alpha
OpenVMS on HP Integrity
Solaris
Solaris for x64
Tru64 UNIX
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.