MMDDYYxw. Format

Writes date values in the form mmdd<yy>yy or mm-dd-<yy>yy, where the x in the format name is a character that represents the special character which separates the month, day, and year. The special character can be a hyphen (-), period (.), blank character, slash (/), colon (:), or no separator; the year can be either 2 or 4 digits.
Category: Date and Time
Alignment: right

Syntax

MMDDYYxw.

Syntax Description

x
identifies a separator or specifies that no separator appear between the month, the day, and the year. These are valid values for x:
B
separates with a blank.
C
separates with a colon.
D
separates with a hyphen.
N
indicates no separator.
P
separates with a period.
S
separates with a slash.
w
specifies the width of the output field.
Default:8
Range:2–10
Interactions:When w has a value of from 2 to 5, the date appears with as much of the month and the day as possible. When w is 7, the date appears as a two-digit year without separators.

When x has a value of N, the width range changes to 2–8.

Details

The MMDDYYxw. format writes SAS date values in one of the following forms:
mmdd<yy>yy
mmxddx<yy>yy
where
mm
is an integer that represents the month.
x
is a specified separator.
dd
is an integer that represents the day of the month.
<yy>yy
is a two-digit or four-digit integer that represents the year.

Example

The following examples use the input value of 19127, which is the SAS date value that corresponds to May 14, 2012.
SAS Statement
Result
 
----+----1----+
put day mmddyyc5.;
05:14
put day mmddyyd8.;
05-14-12
put day mmddyyp10.;
05.14.2012
put day mmddyyn8.;
05142012

See Also

Functions:
DAY Function in SAS Functions and CALL Routines: Reference
MDY Function in SAS Functions and CALL Routines: Reference
MONTH Function in SAS Functions and CALL Routines: Reference
YEAR Function in SAS Functions and CALL Routines: Reference
Informats: