sas SAS Formats

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!


Informats and formats are used to tell SAS how to read and write the data respectively. Informats are commonly used in a datastep when reading data from an external file. Informats are rarely used in PROCs. Formats are commonly used in both data steps and PROCs.


SAS Formats convert either numeric or character values to character values. A format can either be applied using a format or put statement, which changes the way a value is displayed, or using the put function to store the formatted value in a new variable.

There are four categories of formats :

  • Character - instructs SAS to write character data values from character variables.
  • Date and Time - instructs SAS to write data values from variables that represent dates, times, and datetimes.
  • ISO 8601 - instructs SAS to write date, time, and datetime values using the ISO 8601 standard.
  • Numeric - instructs SAS to write numeric data values from numeric variables.

Formats usually take the form <formatname><w>.<d>;, w being the width (including any decimals and the point), d being the number of decimal places.

Common date formats (applied to SAS date values) :

  • date9. e.g. 02AUG2016
  • ddmmyyn8. e.g. 02082016
  • ddmmyy8. e.g. 02/08/16
  • yymmdd10. e.g. 20160802
  • year4. e.g. 2016

Common numeric formats (applied to numbers) :

  • comma11.0 e.g. 1,234,567
  • comma12.2 e.g. 1,234,567.00
  • dollar11.2 e.g. $5,789.12
  • nlmnlgbp11.2 e.g. £2,468.02

Other formats :

  • $hex8., convert string to hex
  • $upcase., convert string to upper-case
  • $quote., enclose a string in quotes

A full list of formats can be found here >

Got any sas Question?