YEARw. Format

Writes date values as the year.

Category: Date and Time
Alignment: Right

Syntax

YEARw.

Syntax Description

w

specifies the width of the output field.

Default 4
Range 2–32
Tip If w is less than 4, the last two digits of the year are printed. Otherwise, the year value is printed as four digits.

Details

The YEARw. format is similar to the DTYEARw. format in that they both write date values. The difference is that YEARw. expects a SAS date value as input, and DTYEARw. expects a datetime value.

Example

The example table uses the input value of 19158, which is the SAS date value that corresponds to June 14, 2012.
SAS Statement
Result
 
----+----1
put date year2.;
12
put date year4.;
2012

See Also

Formats: