DTYEARw. Format

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

Category: Date and Time
Alignment: Right

Syntax

DTYEARw.

Arguments

w

specifies the width of the output field.

Default 4
Range 2–4

Details

remove after conversion

Comparisons

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

Example

The example table uses as input the value 1678898894, which is the SAS datetime value that corresponds to March 14, 2013, at 04:48:14 AM.
Statements
Results
----+----1
select put(1678898894,dtyear.);
2013
select put(1678898894,dtyear2.);
13
select put(1678898894,dtyear3.);
 13
select put(1678898894,dtyear4.);
2013
Last updated: February 23, 2017