YYMMw. Format
Writes SAS date values in the form <yy>yyMmm, where M is a character separator to indicate that the month number follows the M and the year appears as either 2 or 4 digits.
| Category: | Date and Time |
|---|---|
| Alignment: | Right |
| Note: | Beginning in 2025.12, this format supports the BIGINT data type when run in the DS2 language. Set BIGINTPROCESSING=YES to ensure that large integer values—stored as BIGINT—are displayed with full precision, up to 19 digits, without rounding or truncation. BIGINTPROCESSING=YES is recommended for large values that exceed 15–16 digits. |
Table of Contents
Syntax
Required Argument
w
specifies the width of the output field.
| Default | 7 |
|---|---|
| Range | 5–32 |
| Interaction | When w has a value of 5 or 6, the date appears with only the last two digits of the year. When w is 7 or more, the date appears with a four-digit year. |
Details
The YYMMw. format writes SAS date values in the form <yy>yyMmm. Here is an explanation of the syntax:
- <yy>yy
-
is a two-digit or four-digit integer that represents the year.
- M
-
is the character separator.
- mm
-
is an integer that represents the month.
Comparisons
- The YYMMw.d format is similar to the YYMMxw.d format, except the YYMMxw.d format contains a separator such as a hyphen, colon, slash, or period between the year and month.
Example
The following examples use the input value of 20999. 20999 is the SAS date value that corresponds to June 29, 2017.
data _null_;
declare varchar(20) a b c d e ;
method run();
a=put(20999,yymm5.);
b=put(20999,yymm6.);
c=put(20999,yymm.);
d=put(20999,yymm7.);
e=put(20999,yymm10.);
put a= b= c= d= e=;
end;
enddata;
run;
SAS writes the following output to the log.
a=17M06 b= 17M06 c=2017M06 d=2017M06 e= 2017M06
See Also
-
Concepts:
- DS2 Expressions in SAS DS2 Programmer’s Guide
-
Formats: