YYMMDDw. Format

Writes SAS date values in the form yymmdd or [yy]yy-mm-dd, where a hyphen (-) is the separator and the year appears as either 2 or 4 digits.

Category: Date and Time
Alignment: Right

Syntax

YYMMDDw.

Arguments

w

specifies the width of the output field.

Default 8
Range 2–10
Interaction When w has a value of from 2 to 5, the date appears with as much of the year and the month as possible. When w is 7, the date appears as a two-digit year without a hyphen.

Details

The YYMMDDw. format writes SAS date values in one of the following forms:
yymmdd
[yy]yy-mm-dd
[yy]yy
is a two-digit or four-digit integer that represents the year.
-
is the separator.
mm
is an integer that represents the month.
dd
is an integer that represents the day of the month.
To format a date that has a four-digit year and no separators, use the YYMMDDx. format.

Example

The following examples use the input value of 19450, which is the SAS date value that corresponds to April 2, 2013.
Statements
Results
 
----+----1----+
select put(19450,yymmdd2.);
13
select put(19450,yymmdd3.);
 13
select put(19450,yymmdd4.);
1304
select put(19450,yymmdd5.);
13-04
select put(19450,yymmdd6.);
130402
select put(19450,yymmdd7.);
 130402
select put(19450,yymmdd8.);
13-04-02
select put(19450,yymmdd10.);
2013-04-02