years(X;Y)
Returns the number of years between two date-related values.
Syntax
years(X;Y)
Input
Argument | Type | Description |
---|---|---|
X |
any numeric type | A scalar value or the name of a column
containing date-related values Valid values can be of the form:
|
Y |
any numeric type | A scalar value or the name of a column
containing date-related values Valid values can be of the form:
|
For more information, see Dates and time.
Return Value
If the input values are not in one of the supported formats listed above, the function returns an erroneous or illogical output.
Example
In the Monthly Statewide Seasonally Adjusted Unemployment Statistics
table (pub.fin.fred2.bls.smsa), you can create a computed column that
displays an integer value corresponding to the number of years between 1976 and the
month value in the column named month
:
<base table="pub.fin.fred2.bls.smsa"/> <willbe name="example" value="years('1976';month)" label="Years`Since 1976"/> <colord cols="month,example"/>
For a month value of 10/77
(X
=197710), the result would be 1. (There is 1
year from 1976 to 1977.)
For a month value of 10/13
(X
=201310), the result would be 37. (There are
37 years from 1976 to 2013.)