YYQ Function

Returns a SAS date value from year and quarter year values.

Category: Date and Time
Returned data type: DOUBLE

Syntax

YYQ(year, quarter)

Arguments

year

specifies any valid expression that evaluates to a two-digit or four-digit integer that represents the year.

Interaction The YEARCUTOFF= system option defines the year value for two-digit dates.
Data type DOUBLE
See <sql-expression>
FedSQL Expressions

quarter

specifies the quarter of the year (1, 2, 3, or 4).

Data type DOUBLE
See <sql-expression>
FedSQL Expressions

Details

The YYQ function returns a SAS date value that corresponds to the first day of the specified quarter. If either year or quarter is null or missing, or if the quarter value is not valid, the result is a null or missing value.

Example

The following statements illustrate the YYQ function:
Statements
Results
select yyq(2006,3);
  select put(yyq(2006,3), date7.);
  select put(yyq(2006,3), date9.);
16983
01JUL06
01JUL2006
select yyq(2006,4);
  select put(yyq(2006,4), date9.);
17075
01OCT2006

See Also

Last updated: February 23, 2017