Date Formats

Table 4.3 lists some of the available SAS date formats. For each format, an example is shown of a date value in the notation produced by the format. The date '17OCT91'D is used as the example.

Table 4.3 Frequently Used SAS Date Formats

Format and

 

Width

Default

Example

Description

Range

Width

DATEw.

Day, month abbreviation, year:

5–9

7

17OCT91

ddmonyy

   

DAYw.

Day of month

2–32

2

17

     

DDMMYYw.

Day, month, year: dd/mm/yy

2–8

8

17/10/91

     

DOWNAMEw.

Name of day of the week

1–32

9

Thursday

     

JULDAYw.

Day of year

3–32

3

290

     

JULIANw.

Year and day of year: yyddd

5–7

5

91290

     

MMDDYYw.

Month, day, year: mm/dd/yy

2–8

8

10/17/91

     

MMYYw.

Month and year: mmMyyyy

5–32

7

10M1991

     

MMYYCw.

Month and year: mm:yyyy

5–32

7

10:1991

     

MMYYDw.

Month and year: mm-yyyy

5–32

7

10-1991

     

MMYYPw.

Month and year: mm.yyyy

5–32

7

10.1991

     

MMYYSw.

Month and year: mm/yyyy

5–32

7

10/1991

     

MMYYNw.

Month and year: mmyyyy

5–32

6

101991

     

MONNAMEw.

Name of month

1–32

9

October

     

MONTHw.

Month of year

1–32

2

10

     

MONYYw.

Month abbreviation and year:

5–7

5

OCT91

monyy

   

QTRw.

Quarter of year

1–32

1

4

     

QTRRw.

Quarter in roman numerals

3–32

3

IV

     

NENGOw.

Japanese Nengo notation

2–10

10

H.03/10/17

     

WEEKDATEw.

day-of-week, month-name dd, yyyy

3–37

29

Thursday, October 17, 1991

     

WEEKDATXw.

day-of-week, dd month-name yyyy

3–37

29

Thursday, 17 October 1991

     

WEEKDAYw.

Day of week

1–32

1

5

     

WEEKVw.

ISO 8601 year, week, day of week:

3–200

11

1991-W42-04

yyyy-Www-dd

   

WORDDATEw.

month-name dd, yyyy

3–32

18

October 17, 1991

     

WORDDATXw.

dd month-name yyyy

3–32

18

17 October 1991

     

YEARw.

Year: yyyy

2–32

4

1991

     

YYMMw.

Year and month: yyyyMmm

5–32

7

1991M10

     

YYMMCw.

Year and month: yyyy:mm

5–32

7

1991:10

     

YYMMDw.

Year and month: yyyy-mm

5–32

7

1991-10

     

YYMMPw.

Year and month: yyyy.mm

5–32

7

1991.10

     

YYMMSw.

Year and month: yyyy/mm

5–32

7

1991/10

     

YYMMNw.

Year and month: yyyymm

5–32

7

199110

     

YYMONw.

Year and month abbreviation:

5–32

7

1991OCT

yyyymon

   

YYMMDDw.

Year, month, day: yy/mm/dd

2–8

8

91/10/17

     

YYQw.

Year and quarter: yyyyQq

4–6

6

1991Q4

     

YYQCw.

Year and quarter: yyyy:q

4–32

6

1991:4

     

YYQDw.

Year and quarter: yyyy-q

4–32

6

1991-4

     

YYQPw.

Year and quarter: yyyy.q

4–32

6

1991.4

     

YYQSw.

Year and quarter: yyyy/q

4–32

6

1991/4

     

YYQNw.

Year and quarter: yyyyq

3–32

5

19914

     

YYQRw.

Year and quarter in roman

6–32

8

1991QIV

numerals: yyyyQrr

   

YYQRCw.

Year and quarter in roman

6–32

8

1991:IV

numerals: yyyy:rr

   

YYQRDw.

Year and quarter in roman

6–32

8

1991-IV

numerals: yyyy-rr

   

YYQRPw.

Year and quarter in roman

6–32

8

1991.IV

numerals: yyyy.rr

   

YYQRSw.

Year and quarter in roman

6–32

8

1991/IV

numerals: yyyy/rr

   

YYQRNw.

Year and quarter in roman

6–32

8

1991IV

numerals: yyyyrr