Transforming Data with SAS Functions | |
Manipulating SAS Date Values with
Functions![]() ![]() |
![]() |
YEAR Function
The YEAR function enables you to extract the year value from a SAS date value. |
General form, YEAR function:
where date is a SAS date value that is specified as a variable or a SAS date constant. For more information about SAS date constants, refer to SAS Language Reference: Dictionary. |
The value that is returned by the YEAR function is a four-digit numeric value representing the year, for example, 2002. The YEAR function is very similar to the MONTH and DAY functions in purpose and form. |
Function | Description | Form | Sample Value |
---|---|---|---|
YEAR | Extracts the year value from a SAS date value. | YEAR(date) | 2002 |
MONTH | Extracts the month value from a SAS date value. | MONTH(date) | 12 |
DAY | Extracts the day value from a SAS date value. | DAY(date) | 5 |
![]() ![]() ![]() ![]() ![]() ![]() |
|
![]() |
![]() |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.