Search notes:

SAS: informats / formats

Informats specify how data is converted from a character-string representation to the SAS-internal (possibly numerical) value when it is read (hence the in in *informat).
Usually (always?), the informat is ended with a dot.
Informats are defined with the attrib and informat statements, formats with attrib and format statements.
Every (in-)format ends in a dot in order to be able to distinguish them from a variable. If the (in-)format starts with a $ sign, it specifies the character data type.

Informats

An informat defines how text is read into a variable. If the variable is newly created, it also specifies its width and data type.

Formats

The format, if applied to a variable, defines how the variable is printed (or formatted, or displayed). It does not change the value of the variable. The representation is always a character data type.
Formats can be created with proc format.

Defaults

The default for numeric variables is best12., for character variables $w..

See also

N.M to format numbers.
numxN.M is like N.M, yet with using commas instead of dots.
zN.M to right align numbers (and pad them with zeroes on the left side).
ddmmyyXN (and the similar mmddyyXN format) to write dates as 18/09/2011, 18.09.2011, 180911 etc.
dateN to write dates as 13-SEP-2017 or 13SEP17 etc.
is8601dt to write dates in ISO 8601 format: 2016-08-24T06:13:07.
weekdateN to write dates as Wednesday, September 13, 2017, Wednesday, Sep 13, 2017, Wed, Sep 13, 2017, Wednesday or Wed.
datetimeN to display seconds past 1960 as 04JAN60:16:21:38 etc.
timeX.Y to display seconds in an hour:minute:second format 7:18:22.
time formats compares time., tod. and hhmm..
yymmnX for months and years in YYMM or YYYYMM format.
weekday to print Wednesday, Thursday etc.
nldatm: locale dependent date formatting.
worddateN to write dates such as September 18, 2011 or Sep 18, 2011.
percentN.M to format numbers as percentage.
bestN. lets SAS choose the »best« representation.
hex. to convert between a hexadecimal representation of a string or number and the string/number itself.
rb. to »cast« a number into a string or vice versa.
binary. to represent a number in a binary representation (such as 0000101 for 5).
ibW. convert between numbers and their corresponding ascii (?) character (65 = A etc.).
wordsN. to spell numbers.
commaN.M
pvalue
international date formats such as eurdfdd, eurdfde, eurdfdn, eurdfdt and eurdfdwn. The prefix (here: eur) can also be afr, deu, ita etc.)
format, put, putn
Using dictionary.formats to find predefined formats.
In column puts, the format is not applied.
The fmtinfo function returns some information about a format.

Index