Basic Concepts |
SAS Data
Sets![]() ![]() |
Variable Attributes: Informats
Informats determine how data values are read into a SAS data set. You must use informats to read numeric values that contain letters or other special characters. |
For example, the numeric value $1,234 contains two special characters, a dollar sign ($) and a comma (,). You can use an informat (here, COMMA.) to read the value while removing the dollar sign and comma, and then store the resulting value as a standard numeric value. |
Variable Attributes:
Formats
Whereas informats read data values in certain forms into standard SAS values, formats write values out using some particular form. For example, to display the value 1234 as $1,234 in a report, you can use the DOLLAR6.0 format. Usually you have to specify the maximum width of the value to be written. Depending on the particular format, you may also need to specify the number of decimal places to be written. For example, to display the value 5678 as 5,678.00 in a report, you can use the COMMA8.2 format, which specifies a width of 8 including 2 decimal places. |
Example: Using Informats and Formats Together
As shown below, you can use the DATE9. informat to read a date such as 14JAN2002 into a standard numeric value (representing the date as an integer that SAS software uses internally), and then use the MMDDYY10. format to write the value as a date in a different form, 01/14/2002. |
![]() |
![]() |
Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.