DTYEARw. Format

Writes the date part of a datetime value as the year in the form yy or yyyy.

Category: Date and Time
Alignment: Right

Syntax

DTYEARw.

Syntax Description

w

specifies the width of the output field.

Default 4
Range 2–4

Details

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

Example

The example table uses as input the value 1665986932, which is the SAS datetime value that corresponds to October 16, 2012, at 06:08:52 a.m.
SAS Statement
Result
----+----1
put date dtyear.;
2012
put date dtyear2.;
12
put date dtyear3.;
 12
put date year4.;
2012

See Also