Previous Page | Next Page

Formats

YYMMDDw. Format



Writes date values in the form yymmdd or <yy>yy-mm-dd, where a dash is the separator and the year appears as either 2 or 4 digits.
Category: Date and Time
Alignment: right

Syntax
Syntax Description
Details
Examples
See Also

Syntax

YYMMDDw.

Syntax Description

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 dashes.

Details

The YYMMDDw. format writes SAS date values in the form yymmdd or <yy>yy-mm-dd, where

<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.


Examples

The following examples use the input value of 16529, which is the SAS date value that corresponds to April 3, 2005.

SAS Statement Results
 
----+----1----+
put day yymmdd2.;
05
put day yymmdd3.; 
 05
put day yymmdd4.; 
0504
put day yymmdd5.;
05-04
put day yymmdd6.; 
050403
put day yymmdd7.;
 050403
put day yymmdd8.; 
05-04-03
put day yymmdd10.; 
2005-04-03


See Also

Formats:

DATEw. Format

DDMMYYw. Format

MMDDYYw. Format

YYMMDDxw. Format

Functions:

DAY Function

MDY Function

MONTH Function

YEAR Function

Informats:

DATEw. Informat

DDMMYYw. Informat

MMDDYYw. Informat

Previous Page | Next Page | Top of Page