YYQxw. Format

Writes SAS date values in the form [yy]yyq or [yy]yy-q. The x in the format name is a character that represents the special character that separates the year and the quarter of the year. This character can be a hyphen (-), period (.), blank character, slash (/), colon (:), or no separator. The year can be either 2 or 4 digits.

Category: Date and Time
Alignment: Right

Syntax

YYQxw.

Arguments

x

identifies a separator or specifies that no separator appear between the year and the quarter. Valid values for x are any of the following:

C

separates with a colon

D

separates with a hyphen

N

indicates no separator

P

separates with a period

S

separates with a forward slash.

w

specifies the width of the output field.

Default 6
Range 4–32
Interactions When x is set to N, no separator is specified. The width range is then 3–32, and the default changes to 5.
When w has a value of 4 or 5, the date appears with only the last two digits of the year. When w is 6 or more, the date appears with a four-digit year.
When x has a value of N and w has a value of 3 or 4, the date appears with only the last two digits of the year. When x has a value of N and w is 5 or more, the date appears with a four-digit year.

Details

The YYQxw. format writes SAS date values in one of the following forms:
[yy]yyq
[yy]yyxq
where
[yy]yy
is a two-digit or four-digit integer that represents the year.
X
is a specified separator.
q
is an integer (1, 2, 3, or 4) that represents the quarter of the year.

Example

The following examples use the input value of 19537, which is the SAS date value that corresponds to July 28, 2013.
Statements
Results
 
----+----1----+
select put(19537,yyqc4.);
13:2
select put(19537,yyqd.);
2013-2
select put(19537,yyqn3.);
132
select put(19537,yyqp6.);
2013.2
select put(19537,yyqs8.);
  2013/2
Last updated: February 23, 2017