yrqtr(X)

Returns the quarter form of a date-related value.

Syntax

yrqtr(X)

Input

Argument Type Description
X integer or decimal A scalar value or the name of a column containing date-related values
Valid values can be of the form:
  • date
  • month
  • date+time

For more information, see Dates and time.

Return Value

Returns the integer value corresponding to the quarter form (YYYYQ) of a date-related value given as input

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 Hourly U.S. Weather (1993) table (pub.demo.weather.hourly93), you can create a computed column that displays an integer value corresponding to the quarter form of the date value in the column named date:

<base table="pub.demo.weather.hourly93"/>
<willbe name="example" value="yrqtr(date)" label="Quarter Form" format="type:nocommas"/>
<colord cols="date,example"/>
Note: The computed column is formatted using the nocommas display format so that the result will appear without commas (i.e., 19932 as opposed to 19,932).

For a date value of 10/21/93 (X=19931021), the result would be 19934. (October is in the fourth quarter.)

For a date value of 02/07/93 (X=19930207), the result would be 19931. (February is in the first quarter.)