Enhancing Reports |
Formatting Data
Values |
Specifying SAS Formats
The table below describes some SAS formats that are commonly used in reports. |
Format | Specifies values . . . | Example |
---|---|---|
COMMAw.d | with commas and decimal places | comma8.2 |
DOLLARw.d | with dollar signs and commas | dollar6.2 |
MMDDYYw. | as date values in mmddyy order | mmddyy6. |
w. | rounded to the nearest integer in w spaces | 7. |
w.d | rounded to d decimal places in w spaces | 8.2 |
Field Widths
All SAS formats specify the total field width
(w) used for displaying the values in the output.
For example, suppose that the longest value for the variable |
|
Decimal Places
For numeric variables you can also specify the number of decimal places (d), if any, to be displayed in the output. Numbers are rounded to the specified number of decimal places. In the example above, no decimal places are displayed. Writing the whole number 2030 as 2,030.00 requires eight print positions, including two decimal places and the decimal point. |
|
Formatting 15374 with a dollar sign, commas, and two decimal places requires ten print positions. |
|
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.