Table of Contents
SAS (Statistical Analysis System) is a software suite commonly used for data management and analysis. It offers a variety of tools and functions to manipulate and present data in a desired format. One common requirement for data presentation is to display values in dollar format. This can be achieved in SAS by using the FORMAT procedure, which allows users to specify the format of the data being displayed. By using the appropriate format, users can easily convert numerical values into dollar format, including symbols such as currency signs and commas. This provides a clear and concise representation of data in a standardized format, making it easier for users to understand and interpret. The inclusion of dollar format in SAS further enhances the software’s versatility and flexibility in data visualization and reporting.
SAS: Display Values in Dollar Format
You can use the DOLLAR format option in SAS to print values in a column formatted as dollars with:
- A leading dollar sign
- Commas that separate every three digits
- A period that separates the decimal fraction
The following example shows how to use the DOLLAR format option in practice.
Example: Display Values in Dollar Format in SAS
Suppose we have the following dataset in SAS that contains information about the price of various products at some store:
/*create dataset*/
data my_data;
input product $ price;
datalines;
A 4134.50
B 13499.95
C 14695.99
D 1640.00
E 459.93
F 23.29
G 1005.38
;
run;
/*view dataset*/
proc printdata=my_data;

Suppose we would like to format the values in the price column using a dollar format.
We can use the following syntax to do so:
/*view dataset and display price variable in dollar format*/
proc printdata=my_data;
format price dollar10.2;
run;
Each value in the price column is displayed in a dollar format.
When using the dollar10.2 statement, the 10 specifies that a maximum of 10 characters will be needed to display the entire string including the dollar sign, commas and decimal place while the 2 specifies that 2 digits should be shown after the decimal place.
If you don’t want to display any values after the decimal place, you can use dollar8.0 instead:
/*view dataset and display price variable in dollar format without decimal places*/
proc printdata=my_data;
format price dollar8.0;
run;
Notice that each value in the price column is rounded to the nearest dollar and each value after the decimal place has been truncated.
The following tutorials explain how to perform other common tasks in SAS:
Cite this article
stats writer (2024). How can I display values in dollar format using SAS?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-display-values-in-dollar-format-using-sas/
stats writer. "How can I display values in dollar format using SAS?." PSYCHOLOGICAL SCALES, 23 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-display-values-in-dollar-format-using-sas/.
stats writer. "How can I display values in dollar format using SAS?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-display-values-in-dollar-format-using-sas/.
stats writer (2024) 'How can I display values in dollar format using SAS?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-display-values-in-dollar-format-using-sas/.
[1] stats writer, "How can I display values in dollar format using SAS?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.
stats writer. How can I display values in dollar format using SAS?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
