Returns the difference in years between two dates according to specified day count conventions; returns a person’s age.

Category: | Date and Time |

specifies a SAS date value that identifies the starting date.

specifies a SAS date value that identifies the ending date.

identifies a character constant or variable that describes how SAS calculates a date difference or a person’s age. The following character strings are valid:

specifies a 30-day month and a 360-day year in calculating the number of years. Each month is considered to have 30 days, and each year 360 days, regardless of the actual number of days in each month or year.

Alias | '360' |

Tip | If either date falls at the end of a month, it is treated as if it were the last day of a 30-day month. |

uses the actual number of days between dates in calculating the number of years. SAS calculates this value as the number of days that fall in 365-day years divided by 365 plus the number of days that fall in 366-day years divided by 366.

Alias | 'Actual' |

uses the actual number of days between dates in calculating the number of years. SAS calculates this value as the number of days divided by 360, regardless of the actual number of days in each year.

uses the actual number of days between dates in calculating the number of years. SAS calculates this value as the number of days divided by 365, regardless of the actual number of days in each year.

In YRDIF calculations
that use the ACT/ACT basis, both a 365–day year and 366–day
year are taken into account. For example, if n365 equals the number
of days between the start and end dates in a 365–day year,
and n366 equals the number of days between the start and end dates
in a 366–day year, the YRDIF calculation is computed as YRDIF=n365/365.0 + n366/366.0.
This calculation corresponds to the commonly understood ACT/ACT day
count basis that is documented in the financial literature. The values
for basis also includes 30/360,
ACT/360, and ACT/365. Each has well-defined meanings that must be
adhered to in calculating interest payments for specific financial
instruments.

In the following example,
YRDIF returns the difference in years between two dates based on each
of the options for basis.

“Day
count convention.” Wikipedia, 2010. Available Day count convention.

ISDA International
Swaps and Derivatives Association, Inc. “EMU and Market Conventions: Recent Developments.” 1998. Wikipedia. Available EMU and Market Conventions: Recent Developments.

1994. Standard Securities
Calculation Methods – Fixed Income Securities Formulas for
Analytic Measures. Vol. 2. NY, NY: Securities Industry Association.

Copyright © SAS Institute Inc. All rights reserved.