YEARw. Format

Writes SAS date values as the year.

Category: Date and Time
Alignment: Right

Syntax

YEARw.

Arguments

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 print. Otherwise, the year value prints as four digits.

Comparisons

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 SAS datetime value.

Example

The example table uses the input value of 19537, which is the SAS date value that corresponds to June 28, 2013.
Statements
Results
 
----+----1
select put(19537,year2.);
13
select put(19537,year4.);
2013

See Also

Formats: